bkpr: exclude non-wallet events in the balance snapshot

Anchor outputs are ignored by the clightning wallet, but we keep track
of them in the bookkeeper. This causes problems when we do the balance
checks on restart w/ the balance_snapshot -- it results in us printing
out a journal_entry to 'get rid of' the anchors that the clightning node
doesnt know about.

Instead, we mark some outputs as 'ignored' and exclude these from our
account balance sums when we're comparing to the clightning snapshot.
This commit is contained in:
niftynei
2022-07-19 17:04:38 +09:30
committed by Rusty Russell
parent fec8186413
commit a3d82d5a01
12 changed files with 128 additions and 51 deletions

View File

@@ -335,10 +335,13 @@ static void record_ignored_wallet_deposit(struct tracked_output *out)
static void record_anchor(struct tracked_output *out)
{
send_coin_mvt(take(new_coin_wallet_deposit(NULL,
enum mvt_tag *tags = new_tag_arr(NULL, ANCHOR);
tal_arr_expand(&tags, IGNORED);
send_coin_mvt(take(new_coin_wallet_deposit_tagged(NULL,
&out->outpoint,
out->tx_blockheight,
out->sat, ANCHOR)));
out->sat,
tags)));
}
static void record_coin_movements(struct tracked_output *out,