From 83c6cf25d2f773eef8db1fa830a53beaaebcab9e Mon Sep 17 00:00:00 2001 From: niftynei Date: Tue, 19 Jul 2022 17:04:37 +0930 Subject: [PATCH] bkpr: 'to_miner' spends are considered terminal This is a rare case where we RBF the output of a penalty until it no longer has an output value we can reclaim. We ignore the txid for these events when closing a channel. --- plugins/bkpr/recorder.c | 2 ++ tests/test_closing.py | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/plugins/bkpr/recorder.c b/plugins/bkpr/recorder.c index 7cfd7a643..68969baf4 100644 --- a/plugins/bkpr/recorder.c +++ b/plugins/bkpr/recorder.c @@ -386,6 +386,8 @@ bool find_txo_chain(const tal_t *ctx, * might overlap txids */ if (pr->spend && pr->spend->spending_txid + /* 'to_miner' outputs are skipped */ + && !streq(pr->spend->tag, "to_miner") && !txid_in_list(txids, pr->spend->spending_txid) /* We dont trace utxos for non related accts */ && pr->spend->acct_db_id == acct->db_id) { diff --git a/tests/test_closing.py b/tests/test_closing.py index 3b0606667..a443d4240 100644 --- a/tests/test_closing.py +++ b/tests/test_closing.py @@ -1755,6 +1755,10 @@ def test_penalty_rbf_burn(node_factory, bitcoind, executor, chainparams): check_utxos_channel(l2, [channel_id], expected_2) + # Make sure that l2's account is considered closed (has a fee output) + fees = [e for e in l2.rpc.listincome()['income_events'] if e['tag'] == 'onchain_fee'] + assert len(fees) == 1 + @pytest.mark.developer("needs DEVELOPER=1") def test_onchain_first_commit(node_factory, bitcoind):