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

Function find_chain_event_by_id

plugins/bkpr/recorder.c:656–697  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

654}
655
656struct chain_event *find_chain_event_by_id(const tal_t *ctx,
657 struct db *db,
658 u64 event_db_id)
659{
660 struct db_stmt *stmt;
661 struct chain_event *e;
662
663 stmt = db_prepare_v2(db, SQL("SELECT"
664 " e.id"
665 ", e.account_id"
666 ", a.name"
667 ", e.origin"
668 ", e.tag"
669 ", e.credit"
670 ", e.debit"
671 ", e.output_value"
672 ", e.currency"
673 ", e.timestamp"
674 ", e.blockheight"
675 ", e.utxo_txid"
676 ", e.outnum"
677 ", e.spending_txid"
678 ", e.payment_id"
679 ", e.ignored"
680 ", e.stealable"
681 ", e.ev_desc"
682 " FROM chain_events e"
683 " LEFT OUTER JOIN accounts a"
684 " ON e.account_id = a.id"
685 " WHERE "
686 " e.id = ?"));
687
688 db_bind_u64(stmt, 0, event_db_id);
689 db_query_prepared(stmt);
690 if (db_step(stmt))
691 e = stmt2chain_event(ctx, stmt);
692 else
693 e = NULL;
694
695 tal_free(stmt);
696 return e;
697}
698
699static struct chain_event *find_chain_event(const tal_t *ctx,
700 struct db *db,

Callers 6

find_txo_chainFunction · 0.85
is_closed_channel_txidFunction · 0.85
try_update_open_feesFunction · 0.85
fillin_apy_acct_detailsFunction · 0.85

Calls 5

db_bind_u64Function · 0.85
db_query_preparedFunction · 0.85
db_stepFunction · 0.85
stmt2chain_eventFunction · 0.85
tal_freeFunction · 0.85

Tested by

no test coverage detected