Skip to content

Commit c758672

Browse files
committed
bookkeeper: honor start and ent times when consolidating onchain fees.
Fixes: ElementsProject#8318 Reported-by: Shahaha Changelog-Fixed: Plugins: `bkpr_listincome` now honors `start_time` and `end_time` parameters for onchain fees.
1 parent 2539b4f commit c758672

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

plugins/bkpr/incomestmt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ static struct onchain_fee **find_consolidated_fees(const tal_t *ctx,
276276
struct onchain_fee **fee_sums
277277
= tal_arr(ctx, struct onchain_fee *, 0);
278278

279-
sums = calculate_onchain_fee_sums(ctx, bkpr);
279+
sums = calculate_onchain_fee_sums(ctx, bkpr, start_time, end_time);
280280

281281
for (size_t i = 0; i < tal_count(sums); i++) {
282282
/* Find the last matching feerate's data */

plugins/bkpr/onchain_fee.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,11 +383,13 @@ static struct fee_sum **fee_sums_by_txid_and_account(const tal_t *ctx,
383383
}
384384

385385
struct fee_sum **calculate_onchain_fee_sums(const tal_t *ctx,
386-
const struct bkpr *bkpr)
386+
const struct bkpr *bkpr,
387+
u64 start_time,
388+
u64 end_time)
387389
{
388390
struct onchain_fee **ofs;
389391

390-
ofs = list_chain_fees(tmpctx, bkpr);
392+
ofs = list_chain_fees_timebox(tmpctx, bkpr, start_time, end_time);
391393
return fee_sums_by_txid_and_account(ctx, ofs);
392394
}
393395

plugins/bkpr/onchain_fee.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ struct fee_sum **find_account_onchain_fees(const tal_t *ctx,
6565

6666
/* Final all the onchain fees */
6767
struct fee_sum **calculate_onchain_fee_sums(const tal_t *ctx,
68-
const struct bkpr *bkpr);
68+
const struct bkpr *bkpr,
69+
u64 start_time,
70+
u64 end_time);
6971

7072
/* Update our onchain fees now? */
7173
char *maybe_update_onchain_fees(const tal_t *ctx,

tests/test_bookkeeper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1164,7 +1164,7 @@ def test_migration_no_bkpr(node_factory, bitcoind):
11641164
'type': 'channel'}]
11651165

11661166

1167-
@pytest.mark.xfail(strict=True)
1167+
@unittest.skipIf(TEST_NETWORK != 'regtest', "External wallet support doesn't work with elements yet.")
11681168
def test_listincome_timebox(node_factory, bitcoind):
11691169
l1 = node_factory.get_node()
11701170
addr = l1.rpc.newaddr()['bech32']

0 commit comments

Comments
 (0)