Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion plugins/bkpr/recorder.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,14 @@ bool find_txo_chain(const tal_t *ctx,
bool is_complete = true;
const char *start_acct_name;

assert(acct->open_event_db_id);
/* If we have lost our database and used recovery, this can be
* NULL. That's the least of our problems though! */
if (!acct->open_event_db_id) {
plugin_log(cmd->plugin, LOG_BROKEN,
"Cannot find the open_event for %s: did we lose our db?",
acct->name);
return false;
}
open_ev = find_chain_event_by_id(ctx, bkpr, cmd,
*acct->open_event_db_id);

Expand Down
5 changes: 4 additions & 1 deletion tests/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -3141,7 +3141,7 @@ def test_emergencyrecover(node_factory, bitcoind):
Test emergencyrecover
"""
l1, l2 = node_factory.get_nodes(2, opts=[{'may_reconnect': True,
'broken_log': 'ERROR: Unknown commitment #.*, recovering our funds'},
'broken_log': 'ERROR: Unknown commitment #.*, recovering our funds|plugin-bookkeeper: Cannot find the open_event for '},
{'may_reconnect': True}])

l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
Expand Down Expand Up @@ -3177,6 +3177,9 @@ def test_emergencyrecover(node_factory, bitcoind):
wait_for(lambda: l1.rpc.listfunds()["channels"][0]["state"] == "ONCHAIN")
wait_for(lambda: l2.rpc.listfunds()["channels"][0]["state"] == "ONCHAIN")

# Does bookkeeper get upset?
l1.rpc.bkpr_listbalances()

withdraw = l1.rpc.withdraw(l2.rpc.newaddr('bech32')['bech32'], 'all')
# Should have two inputs
assert len(bitcoind.rpc.decoderawtransaction(withdraw['tx'])['vin']) == 2
Expand Down
Loading