| 3949 | const struct sha256 *local_invreq_id); |
| 3950 | |
| 3951 | struct 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," |