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

Function find_close_account

plugins/bkpr/recorder.c:537–566  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

535}
536
537struct account *find_close_account(const tal_t *ctx,
538 struct db *db,
539 struct bitcoin_txid *txid)
540{
541 struct db_stmt *stmt;
542 struct account *close_acct;
543 char *acct_name;
544
545 stmt = db_prepare_v2(db, SQL("SELECT"
546 " a.name"
547 " FROM chain_events e"
548 " LEFT OUTER JOIN accounts a"
549 " ON e.account_id = a.id"
550 " WHERE "
551 " e.tag = ?"
552 " AND e.spending_txid = ?"));
553
554 db_bind_text(stmt, 0, mvt_tag_str(CHANNEL_CLOSE));
555 db_bind_txid(stmt, 1, txid);
556 db_query_prepared(stmt);
557
558 if (db_step(stmt)) {
559 acct_name = db_col_strdup(stmt, stmt, "a.name");
560 close_acct = find_account(ctx, db, acct_name);
561 } else
562 close_acct = NULL;
563
564 tal_free(stmt);
565 return close_acct;
566}
567
568void maybe_mark_account_onchain(struct db *db, struct account *acct)
569{

Callers 1

do_account_close_checksFunction · 0.85

Calls 8

db_bind_textFunction · 0.85
db_bind_txidFunction · 0.85
db_query_preparedFunction · 0.85
db_stepFunction · 0.85
db_col_strdupFunction · 0.85
find_accountFunction · 0.85
tal_freeFunction · 0.85
mvt_tag_strFunction · 0.50

Tested by

no test coverage detected