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

Function account_onchain_fees

plugins/bkpr/recorder.c:1159–1191  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1157}
1158
1159struct onchain_fee **account_onchain_fees(const tal_t *ctx,
1160 struct db *db,
1161 struct account *acct)
1162{
1163 struct db_stmt *stmt;
1164 struct onchain_fee **results;
1165
1166 stmt = db_prepare_v2(db, SQL("SELECT"
1167 " of.account_id"
1168 ", a.name"
1169 ", of.txid"
1170 ", of.credit"
1171 ", of.debit"
1172 ", of.currency"
1173 ", of.timestamp"
1174 ", of.update_count"
1175 " FROM onchain_fees of"
1176 " LEFT OUTER JOIN accounts a"
1177 " ON a.id = of.account_id"
1178 " WHERE of.account_id = ?;"));
1179
1180 db_bind_u64(stmt, 0, acct->db_id);
1181 db_query_prepared(stmt);
1182
1183 results = tal_arr(ctx, struct onchain_fee *, 0);
1184 while (db_step(stmt)) {
1185 struct onchain_fee *of = stmt2onchain_fee(results, stmt);
1186 tal_arr_expand(&results, of);
1187 }
1188 tal_free(stmt);
1189
1190 return results;
1191}
1192
1193struct account **list_accounts(const tal_t *ctx, struct db *db)
1194{

Callers 1

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 1