mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
balance_snapshot: don't count unconfirmed utxos
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.
This commit is contained in:
@@ -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++) {
|
for (size_t i = 0; i < ARRAY_SIZE(utxo_states); i++) {
|
||||||
utxos = wallet_get_utxos(NULL, ld->wallet, utxo_states[i]);
|
utxos = wallet_get_utxos(NULL, ld->wallet, utxo_states[i]);
|
||||||
for (size_t j = 0; j < tal_count(utxos); j++) {
|
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,
|
if (!amount_msat_add_sat(&bal->balance,
|
||||||
bal->balance, utxos[j]->amount))
|
bal->balance, utxos[j]->amount))
|
||||||
fatal("Overflow adding node balance");
|
fatal("Overflow adding node balance");
|
||||||
|
|||||||
Reference in New Issue
Block a user