bkpr: create accounts for zero sat channels

we weren't making records for 'missed' accounts that had a zero balance
at snapshot time (if peer opens channel and is unused)

Fixes: #5502
Reported-By: https://github.com/niftynei/cln-logmaid
This commit is contained in:
niftynei
2022-08-08 13:40:08 -05:00
committed by neil saitug
parent 1ff8e1bacb
commit 23cd58402a
7 changed files with 123 additions and 24 deletions

View File

@@ -1331,9 +1331,14 @@ def test_forward_pad_fees_and_cltv(node_factory, bitcoind):
wait_for(lambda: len(_income_tagset(l1, tags)) == 2)
incomes = _income_tagset(l1, tags)
# the balance on l3 should equal the invoice
bal = only_one(only_one(l3.rpc.bkpr_listbalances()['accounts'])['balances'])['balance_msat']
accts = l3.rpc.bkpr_listbalances()['accounts']
assert len(accts) == 2
wallet = accts[0]
chan_acct = accts[1]
assert wallet['account'] == 'wallet'
assert only_one(wallet['balances'])['balance_msat'] == Millisatoshi(0)
assert incomes[0]['tag'] == 'invoice'
assert Millisatoshi(bal) == incomes[0]['debit_msat']
assert only_one(chan_acct['balances'])['balance_msat'] == incomes[0]['debit_msat']
inve = only_one([e for e in l1.rpc.bkpr_listaccountevents()['events'] if e['tag'] == 'invoice'])
assert inve['debit_msat'] == incomes[0]['debit_msat'] + incomes[1]['debit_msat']