Skip to content

Commit

Permalink
bkpr-recorder: fatal if there's an error with a database statement
Browse files Browse the repository at this point in the history
We were silently failing when NULLS FIRST wasn't found on older boxes
(running sqlite3 < v3.30.1)
  • Loading branch information
niftynei committed Aug 16, 2022
1 parent fdfca9e commit 1a25651
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions plugins/bkpr/recorder.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ static struct chain_event **find_chain_events(const tal_t *ctx,
struct chain_event **results;

db_query_prepared(stmt);
if (stmt->error)
db_fatal("find_chain_events err: %s", stmt->error);
results = tal_arr(ctx, struct chain_event *, 0);
while (db_step(stmt)) {
struct chain_event *e = stmt2chain_event(results, stmt);
Expand Down
1 change: 1 addition & 0 deletions plugins/bkpr/test/run-recorder.c
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,7 @@ static bool test_onchain_fee_chan_close(const tal_t *ctx, struct plugin *p)
CHECK(acct->onchain_resolved_block == 0);
db_begin_transaction(db);
maybe_mark_account_onchain(db, acct);
CHECK_MSG(!db_err, db_err);
CHECK(acct->onchain_resolved_block == blockheight + 2);
err = update_channel_onchain_fees(ctx, db, acct);
CHECK_MSG(!err, err);
Expand Down

0 comments on commit 1a25651

Please sign in to comment.