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

Function wallet_add_payment

wallet/wallet.c:3988–4121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3986 const struct sha256 *local_invreq_id);
3987
3988struct wallet_payment *wallet_add_payment(const tal_t *ctx,
3989 struct wallet *wallet,
3990 u32 timestamp,
3991 const u32 *completed_at,
3992 const struct sha256 *payment_hash,
3993 u64 partid,
3994 u64 groupid,
3995 enum payment_status status,
3996 /* The destination may not be known if we used `sendonion` */
3997 const struct node_id *destination TAKES,
3998 struct amount_msat msatoshi,
3999 struct amount_msat msatoshi_sent,
4000 struct amount_msat total_msat,
4001 /* If and only if PAYMENT_COMPLETE */
4002 const struct preimage *payment_preimage TAKES,
4003 const struct secret *path_secrets TAKES,
4004 const struct node_id *route_nodes TAKES,
4005 const struct short_channel_id *route_channels TAKES,
4006 const char *invstring TAKES,
4007 const char *label TAKES,
4008 const char *description TAKES,
4009 const u8 *failonion TAKES,
4010 const struct sha256 *local_invreq_id)
4011{
4012 struct db_stmt *stmt;
4013 struct wallet_payment *payment;
4014 u64 id;
4015
4016 id = sendpay_index_created(wallet->ld,
4017 payment_hash,
4018 partid, groupid, status);
4019
4020 payment = wallet_payment_new(ctx, id, 0,
4021 timestamp,
4022 completed_at,
4023 payment_hash,
4024 partid,
4025 groupid,
4026 status,
4027 destination,
4028 msatoshi,
4029 msatoshi_sent,
4030 total_msat,
4031 payment_preimage,
4032 path_secrets,
4033 route_nodes,
4034 route_channels,
4035 invstring,
4036 label,
4037 description,
4038 failonion,
4039 local_invreq_id);
4040 stmt = db_prepare_v2(
4041 wallet->db,
4042 SQL("INSERT INTO payments ("
4043 " id,"
4044 " status,"
4045 " 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