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

Function wallet_payment_set_failinfo

wallet/wallet.c:4402–4461  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4400}
4401
4402void wallet_payment_set_failinfo(struct wallet *wallet,
4403 const struct sha256 *payment_hash,
4404 u64 partid,
4405 const struct onionreply *failonionreply,
4406 bool faildestperm,
4407 int failindex,
4408 enum onion_wire failcode,
4409 const struct node_id *failnode,
4410 const struct short_channel_id *failchannel,
4411 const u8 *failupdate /*tal_arr*/,
4412 const char *faildetail,
4413 int faildirection)
4414{
4415 struct db_stmt *stmt;
4416
4417 stmt = db_prepare_v2(wallet->db, SQL("UPDATE payments"
4418 " SET failonionreply=?"
4419 " , faildestperm=?"
4420 " , failindex=?"
4421 " , failcode=?"
4422 " , failnode=?"
4423 " , failscid=?"
4424 " , faildirection=?"
4425 " , failupdate=?"
4426 " , faildetail=?"
4427 " WHERE payment_hash=?"
4428 " AND partid=?;"));
4429 if (failonionreply)
4430 db_bind_talarr(stmt, failonionreply->contents);
4431 else
4432 db_bind_null(stmt);
4433 db_bind_int(stmt, faildestperm ? 1 : 0);
4434 db_bind_int(stmt, failindex);
4435 db_bind_int(stmt, (int) failcode);
4436
4437 if (failnode)
4438 db_bind_node_id(stmt, failnode);
4439 else
4440 db_bind_null(stmt);
4441
4442 if (failchannel) {
4443 db_bind_short_channel_id(stmt, *failchannel);
4444 db_bind_int(stmt, faildirection);
4445 } else {
4446 db_bind_null(stmt);
4447 db_bind_null(stmt);
4448 }
4449
4450 db_bind_talarr(stmt, failupdate);
4451
4452 if (faildetail != NULL)
4453 db_bind_text(stmt, faildetail);
4454 else
4455 db_bind_null(stmt);
4456
4457 db_bind_sha256(stmt, payment_hash);
4458 db_bind_u64(stmt, partid);
4459

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