| 181 | } |
| 182 | |
| 183 | struct chain_event **account_get_chain_events(const tal_t *ctx, |
| 184 | struct db *db, |
| 185 | struct account *acct) |
| 186 | { |
| 187 | struct db_stmt *stmt; |
| 188 | |
| 189 | stmt = db_prepare_v2(db, SQL("SELECT" |
| 190 | " e.id" |
| 191 | ", e.account_id" |
| 192 | ", a.name" |
| 193 | ", e.origin" |
| 194 | ", e.tag" |
| 195 | ", e.credit" |
| 196 | ", e.debit" |
| 197 | ", e.output_value" |
| 198 | ", e.currency" |
| 199 | ", e.timestamp" |
| 200 | ", e.blockheight" |
| 201 | ", e.utxo_txid" |
| 202 | ", e.outnum" |
| 203 | ", e.spending_txid" |
| 204 | ", e.payment_id" |
| 205 | ", e.ignored" |
| 206 | ", e.stealable" |
| 207 | ", e.ev_desc" |
| 208 | " FROM chain_events e" |
| 209 | " LEFT OUTER JOIN accounts a" |
| 210 | " ON e.account_id = a.id" |
| 211 | " WHERE e.account_id = ?" |
| 212 | " ORDER BY e.timestamp, e.id")); |
| 213 | |
| 214 | db_bind_int(stmt, 0, acct->db_id); |
| 215 | return find_chain_events(ctx, take(stmt)); |
| 216 | } |
| 217 | |
| 218 | static struct chain_event **find_txos_for_tx(const tal_t *ctx, |
| 219 | struct db *db, |