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

Function wallet_payment_set_failinfo

wallet/wallet.c:3468–3527  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3466}
3467
3468void wallet_payment_set_failinfo(struct wallet *wallet,
3469 const struct sha256 *payment_hash,
3470 u64 partid,
3471 const struct onionreply *failonionreply,
3472 bool faildestperm,
3473 int failindex,
3474 enum onion_wire failcode,
3475 const struct node_id *failnode,
3476 const struct short_channel_id *failchannel,
3477 const u8 *failupdate /*tal_arr*/,
3478 const char *faildetail,
3479 int faildirection)
3480{
3481 struct db_stmt *stmt;
3482
3483 stmt = db_prepare_v2(wallet->db, SQL("UPDATE payments"
3484 " SET failonionreply=?"
3485 " , faildestperm=?"
3486 " , failindex=?"
3487 " , failcode=?"
3488 " , failnode=?"
3489 " , failscid=?"
3490 " , failupdate=?"
3491 " , faildetail=?"
3492 " , faildirection=?"
3493 " WHERE payment_hash=?"
3494 " AND partid=?;"));
3495 if (failonionreply)
3496 db_bind_talarr(stmt, 0, failonionreply->contents);
3497 else
3498 db_bind_null(stmt, 0);
3499 db_bind_int(stmt, 1, faildestperm ? 1 : 0);
3500 db_bind_int(stmt, 2, failindex);
3501 db_bind_int(stmt, 3, (int) failcode);
3502
3503 if (failnode)
3504 db_bind_node_id(stmt, 4, failnode);
3505 else
3506 db_bind_null(stmt, 4);
3507
3508 if (failchannel) {
3509 db_bind_scid(stmt, 5, failchannel);
3510 db_bind_int(stmt, 8, faildirection);
3511 } else {
3512 db_bind_null(stmt, 5);
3513 db_bind_null(stmt, 8);
3514 }
3515
3516 db_bind_talarr(stmt, 6, failupdate);
3517
3518 if (faildetail != NULL)
3519 db_bind_text(stmt, 7, faildetail);
3520 else
3521 db_bind_null(stmt, 7);
3522
3523 db_bind_sha256(stmt, 9, payment_hash);
3524 db_bind_u64(stmt, 10, partid);
3525

Callers 1

payment_failedFunction · 0.85

Calls 9

db_bind_talarrFunction · 0.85
db_bind_nullFunction · 0.85
db_bind_intFunction · 0.85
db_bind_node_idFunction · 0.85
db_bind_scidFunction · 0.85
db_bind_textFunction · 0.85
db_bind_sha256Function · 0.85
db_bind_u64Function · 0.85
db_exec_prepared_v2Function · 0.85

Tested by

no test coverage detected