bkpr: check for channel resolution for any "originated" event

We were failing to mark channels as resolved b/c we weren't using later
events to external (but originated from this account) events as signals
to run the channel resolution check.

This fixes that, and adds a test.
This commit is contained in:
niftynei
2022-07-19 17:04:39 +09:30
committed by Rusty Russell
parent cf8b30d2e8
commit d72033882f
3 changed files with 85 additions and 2 deletions

View File

@@ -862,7 +862,9 @@ static char *do_account_close_checks(const tal_t *ctx,
db_begin_transaction(db);
/* If is an external acct event, might be close channel related */
if (!is_channel_account(acct) && !e->spending_txid)
if (!is_channel_account(acct) && e->origin_acct) {
closed_acct = find_account(ctx, db, e->origin_acct);
} else if (!is_channel_account(acct) && !e->spending_txid)
closed_acct = find_close_account(ctx, db, &e->outpoint.txid);
else
closed_acct = acct;