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

Function wallet_payment_set_failinfo

wallet/wallet.c:4439–4498  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4437}
4438
4439void wallet_payment_set_failinfo(struct wallet *wallet,
4440 const struct sha256 *payment_hash,
4441 u64 partid,
4442 const struct onionreply *failonionreply,
4443 bool faildestperm,
4444 int failindex,
4445 enum onion_wire failcode,
4446 const struct node_id *failnode,
4447 const struct short_channel_id *failchannel,
4448 const u8 *failupdate /*tal_arr*/,
4449 const char *faildetail,
4450 int faildirection)
4451{
4452 struct db_stmt *stmt;
4453
4454 stmt = db_prepare_v2(wallet->db, SQL("UPDATE payments"
4455 " SET failonionreply=?"
4456 " , faildestperm=?"
4457 " , failindex=?"
4458 " , failcode=?"
4459 " , failnode=?"
4460 " , failscid=?"
4461 " , faildirection=?"
4462 " , failupdate=?"
4463 " , faildetail=?"
4464 " WHERE payment_hash=?"
4465 " AND partid=?;"));
4466 if (failonionreply)
4467 db_bind_talarr(stmt, failonionreply->contents);
4468 else
4469 db_bind_null(stmt);
4470 db_bind_int(stmt, faildestperm ? 1 : 0);
4471 db_bind_int(stmt, failindex);
4472 db_bind_int(stmt, (int) failcode);
4473
4474 if (failnode)
4475 db_bind_node_id(stmt, failnode);
4476 else
4477 db_bind_null(stmt);
4478
4479 if (failchannel) {
4480 db_bind_short_channel_id(stmt, *failchannel);
4481 db_bind_int(stmt, faildirection);
4482 } else {
4483 db_bind_null(stmt);
4484 db_bind_null(stmt);
4485 }
4486
4487 db_bind_talarr(stmt, failupdate);
4488
4489 if (faildetail != NULL)
4490 db_bind_text(stmt, faildetail);
4491 else
4492 db_bind_null(stmt);
4493
4494 db_bind_sha256(stmt, payment_hash);
4495 db_bind_u64(stmt, partid);
4496

Callers 2

payment_failedFunction · 0.85
self_paymentFunction · 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_short_channel_idFunction · 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