Skip to content

Commit

Permalink
balance_snapshot: don't count unconfirmed utxos
Browse files Browse the repository at this point in the history
This was causing journal_entries to show up in the accountant plugin,
since we don't emit events for unconfirmed events until they're actually
confirmed onchain.
  • Loading branch information
niftynei committed Mar 3, 2022
1 parent 4ed450f commit 995b3df
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lightningd/coin_mvts.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ void send_account_balance_snapshot(struct lightningd *ld, u32 blockheight)
for (size_t i = 0; i < ARRAY_SIZE(utxo_states); i++) {
utxos = wallet_get_utxos(NULL, ld->wallet, utxo_states[i]);
for (size_t j = 0; j < tal_count(utxos); j++) {
/* Don't count unconfirmed utxos! */
if (!utxos[j]->spendheight && !utxos[j]->blockheight)
continue;
if (!amount_msat_add_sat(&bal->balance,
bal->balance, utxos[j]->amount))
fatal("Overflow adding node balance");
Expand Down

0 comments on commit 995b3df

Please sign in to comment.