bookkeeper: honor start and ent times when consolidating onchain fees.
What changed, and why it matters
This is a bug fix in the bookkeeper plugin, which is used for accounting and reporting. Previously, when summarizing on-chain transaction fees, the plugin ignored user-supplied start and end times and included all fees instead. The fix makes the fee summary respect those time boundaries. It is a correctness issue for financial reporting, not a security vulnerability that allows theft, unauthorized access, or denial of service.
No security action required. Treat as a normal bug fix release. Users relying on `bkpr_listincome` for fee accounting should update to obtain accurate time-bounded reports.
Security signals we found
No security-relevant signals detected in the diff or commit message.
Change is a functional correctness fix for RPC/accounting output, not a memory safety, authentication, authorization, or cryptographic issue.
Evidence from the diff
The commit modifies calculate_onchain_fee_sums() in plugins/bkpr/onchain_fee.c to accept start_time and end_time parameters and passes them to list_chain_fees_timebox() instead of the unbounded list_chain_fees(). The header and caller in incomestmt.c are updated accordingly. A test marker is changed from pytest.mark.xfail(strict=True) to a conditional skip for non-regtest networks, effectively enabling the test on regtest.
Changed components
plugins/bkpr/onchain_fee.cplugins/bkpr/onchain_fee.hplugins/bkpr/incomestmt.ctests/test_bookkeeper.pybkpr_listincome RPC commandInspect captured patch +9 / −5
diff --git a/plugins/bkpr/incomestmt.c b/plugins/bkpr/incomestmt.c
index faf13552..d9041f56 100644
--- a/plugins/bkpr/incomestmt.c
+++ b/plugins/bkpr/incomestmt.c
@@ -276,7 +276,7 @@ static struct onchain_fee **find_consolidated_fees(const tal_t *ctx,
struct onchain_fee **fee_sums
= tal_arr(ctx, struct onchain_fee *, 0);
- sums = calculate_onchain_fee_sums(ctx, bkpr);
+ sums = calculate_onchain_fee_sums(ctx, bkpr, start_time, end_time);
for (size_t i = 0; i < tal_count(sums); i++) {
/* Find the last matching feerate's data */
diff --git a/plugins/bkpr/onchain_fee.c b/plugins/bkpr/onchain_fee.c
index 0bec506b..6cdce78a 100644
--- a/plugins/bkpr/onchain_fee.c
+++ b/plugins/bkpr/onchain_fee.c
@@ -383,11 +383,13 @@ static struct fee_sum **fee_sums_by_txid_and_account(const tal_t *ctx,
}
struct fee_sum **calculate_onchain_fee_sums(const tal_t *ctx,
- const struct bkpr *bkpr)
+ const struct bkpr *bkpr,
+ u64 start_time,
+ u64 end_time)
{
struct onchain_fee **ofs;
- ofs = list_chain_fees(tmpctx, bkpr);
+ ofs = list_chain_fees_timebox(tmpctx, bkpr, start_time, end_time);
return fee_sums_by_txid_and_account(ctx, ofs);
}
diff --git a/plugins/bkpr/onchain_fee.h b/plugins/bkpr/onchain_fee.h
index 5e3be5e5..3dbbbd2d 100644
--- a/plugins/bkpr/onchain_fee.h
+++ b/plugins/bkpr/onchain_fee.h
@@ -65,7 +65,9 @@ struct fee_sum **find_account_onchain_fees(const tal_t *ctx,
/* Final all the onchain fees */
struct fee_sum **calculate_onchain_fee_sums(const tal_t *ctx,
- const struct bkpr *bkpr);
+ const struct bkpr *bkpr,
+ u64 start_time,
+ u64 end_time);
/* Update our onchain fees now? */
char *maybe_update_onchain_fees(const tal_t *ctx,
diff --git a/tests/test_bookkeeper.py b/tests/test_bookkeeper.py
index c9ddf9e6..2beceb84 100644
--- a/tests/test_bookkeeper.py
+++ b/tests/test_bookkeeper.py
@@ -1164,7 +1164,7 @@ def test_migration_no_bkpr(node_factory, bitcoind):
'type': 'channel'}]
-@pytest.mark.xfail(strict=True)
+@unittest.skipIf(TEST_NETWORK != 'regtest', "External wallet support doesn't work with elements yet.")
def test_listincome_timebox(node_factory, bitcoind):
l1 = node_factory.get_node()
addr = l1.rpc.newaddr()['bech32']
Why this scored 19/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.