MCPcopy Create free account
hub / github.com/ElementsProject/lightning / wallet_add_payment

Function wallet_add_payment

wallet/wallet.c:3951–4084  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3949 const struct sha256 *local_invreq_id);
3950
3951struct wallet_payment *wallet_add_payment(const tal_t *ctx,
3952 struct wallet *wallet,
3953 u32 timestamp,
3954 const u32 *completed_at,
3955 const struct sha256 *payment_hash,
3956 u64 partid,
3957 u64 groupid,
3958 enum payment_status status,
3959 /* The destination may not be known if we used `sendonion` */
3960 const struct node_id *destination TAKES,
3961 struct amount_msat msatoshi,
3962 struct amount_msat msatoshi_sent,
3963 struct amount_msat total_msat,
3964 /* If and only if PAYMENT_COMPLETE */
3965 const struct preimage *payment_preimage TAKES,
3966 const struct secret *path_secrets TAKES,
3967 const struct node_id *route_nodes TAKES,
3968 const struct short_channel_id *route_channels TAKES,
3969 const char *invstring TAKES,
3970 const char *label TAKES,
3971 const char *description TAKES,
3972 const u8 *failonion TAKES,
3973 const struct sha256 *local_invreq_id)
3974{
3975 struct db_stmt *stmt;
3976 struct wallet_payment *payment;
3977 u64 id;
3978
3979 id = sendpay_index_created(wallet->ld,
3980 payment_hash,
3981 partid, groupid, status);
3982
3983 payment = wallet_payment_new(ctx, id, 0,
3984 timestamp,
3985 completed_at,
3986 payment_hash,
3987 partid,
3988 groupid,
3989 status,
3990 destination,
3991 msatoshi,
3992 msatoshi_sent,
3993 total_msat,
3994 payment_preimage,
3995 path_secrets,
3996 route_nodes,
3997 route_channels,
3998 invstring,
3999 label,
4000 description,
4001 failonion,
4002 local_invreq_id);
4003 stmt = db_prepare_v2(
4004 wallet->db,
4005 SQL("INSERT INTO payments ("
4006 " id,"
4007 " status,"
4008 " payment_hash,"

Callers 4

test_payment_crudFunction · 0.85
send_payment_coreFunction · 0.85
self_paymentFunction · 0.85

Calls 14

wallet_payment_newFunction · 0.85
db_bind_u64Function · 0.85
db_bind_intFunction · 0.85
db_bind_sha256Function · 0.85
db_bind_node_idFunction · 0.85
db_bind_nullFunction · 0.85
db_bind_amount_msatFunction · 0.85
db_bind_secret_arrFunction · 0.85
db_bind_node_id_arrFunction · 0.85
db_bind_textFunction · 0.85
db_exec_prepared_v2Function · 0.85

Tested by 1

test_payment_crudFunction · 0.68