| 3986 | const struct sha256 *local_invreq_id); |
| 3987 | |
| 3988 | struct 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," |