bookkeeper: honor start and ent times when consolidating onchain fees.

Fixes: https://github.com/ElementsProject/lightning/issues/8318

Reported-by: Shahaha
Changelog-Fixed: Plugins: `bkpr_listincome` now honors `start_time` and `end_time` parameters for onchain fees.
This commit is contained in:
Rusty Russell
2025-10-21 16:25:28 +10:30
parent 2539b4f199
commit c758672ac0
4 changed files with 9 additions and 5 deletions

View File

@@ -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 */

View File

@@ -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);
}

View File

@@ -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,

View File

@@ -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']