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

Function account_get_chain_fees

plugins/bkpr/recorder.c:1005–1040  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1003}
1004
1005struct onchain_fee **account_get_chain_fees(const tal_t *ctx, struct db *db,
1006 struct account *acct)
1007{
1008 struct db_stmt *stmt;
1009 struct onchain_fee **results;
1010
1011 stmt = db_prepare_v2(db, SQL("SELECT"
1012 " of.account_id"
1013 ", a.name"
1014 ", of.txid"
1015 ", of.credit"
1016 ", of.debit"
1017 ", of.currency"
1018 ", of.timestamp"
1019 ", of.update_count"
1020 " FROM onchain_fees of"
1021 " LEFT OUTER JOIN accounts a"
1022 " ON a.id = of.account_id"
1023 " WHERE of.account_id = ?"
1024 " ORDER BY "
1025 " of.timestamp"
1026 ", of.txid"
1027 ", of.update_count"));
1028
1029 db_bind_u64(stmt, 0, acct->db_id);
1030 db_query_prepared(stmt);
1031
1032 results = tal_arr(ctx, struct onchain_fee *, 0);
1033 while (db_step(stmt)) {
1034 struct onchain_fee *of = stmt2onchain_fee(results, stmt);
1035 tal_arr_expand(&results, of);
1036 }
1037 tal_free(stmt);
1038
1039 return results;
1040}
1041
1042struct onchain_fee **list_chain_fees_timebox(const tal_t *ctx, struct db *db,
1043 u64 start_time, u64 end_time)

Callers 1

json_list_account_eventsFunction · 0.85

Calls 5

db_bind_u64Function · 0.85
db_query_preparedFunction · 0.85
db_stepFunction · 0.85
stmt2onchain_feeFunction · 0.85
tal_freeFunction · 0.85

Tested by

no test coverage detected