| 1040 | } |
| 1041 | |
| 1042 | struct onchain_fee **list_chain_fees_timebox(const tal_t *ctx, struct db *db, |
| 1043 | u64 start_time, u64 end_time) |
| 1044 | { |
| 1045 | struct db_stmt *stmt; |
| 1046 | struct onchain_fee **results; |
| 1047 | |
| 1048 | stmt = db_prepare_v2(db, SQL("SELECT" |
| 1049 | " of.account_id" |
| 1050 | ", a.name" |
| 1051 | ", of.txid" |
| 1052 | ", of.credit" |
| 1053 | ", of.debit" |
| 1054 | ", of.currency" |
| 1055 | ", of.timestamp" |
| 1056 | ", of.update_count" |
| 1057 | " FROM onchain_fees of" |
| 1058 | " LEFT OUTER JOIN accounts a" |
| 1059 | " ON a.id = of.account_id" |
| 1060 | " WHERE timestamp > ?" |
| 1061 | " AND timestamp <= ?" |
| 1062 | " ORDER BY " |
| 1063 | " of.timestamp" |
| 1064 | ", of.account_id" |
| 1065 | ", of.txid" |
| 1066 | ", of.update_count")); |
| 1067 | |
| 1068 | db_bind_u64(stmt, 0, start_time); |
| 1069 | db_bind_u64(stmt, 1, end_time); |
| 1070 | db_query_prepared(stmt); |
| 1071 | |
| 1072 | results = tal_arr(ctx, struct onchain_fee *, 0); |
| 1073 | while (db_step(stmt)) { |
| 1074 | struct onchain_fee *of = stmt2onchain_fee(results, stmt); |
| 1075 | tal_arr_expand(&results, of); |
| 1076 | } |
| 1077 | tal_free(stmt); |
| 1078 | |
| 1079 | return results; |
| 1080 | } |
| 1081 | |
| 1082 | struct onchain_fee **list_chain_fees(const tal_t *ctx, struct db *db) |
| 1083 | { |
no test coverage detected