@@ -1162,3 +1162,34 @@ def test_migration_no_bkpr(node_factory, bitcoind):
11621162 'is_rebalance' : False ,
11631163 'tag' : 'journal_entry' ,
11641164 'type' : 'channel' }]
1165+
1166+
1167+ @pytest .mark .xfail (strict = True )
1168+ def test_listincome_timebox (node_factory , bitcoind ):
1169+ l1 = node_factory .get_node ()
1170+ addr = l1 .rpc .newaddr ()['bech32' ]
1171+
1172+ amount = 1111111
1173+ bitcoind .rpc .sendtoaddress (addr , amount / 10 ** 8 )
1174+
1175+ bitcoind .generate_block (1 , wait_for_mempool = 1 )
1176+ wait_for (lambda : len (l1 .rpc .listfunds ()['outputs' ]) == 1 )
1177+
1178+ waddr = bitcoind .rpc .getnewaddress ()
1179+
1180+ # Ok, now we send some funds to an external address, get change.
1181+ l1 .rpc .withdraw (waddr , amount // 2 )
1182+ bitcoind .generate_block (1 , wait_for_mempool = 1 )
1183+ wait_for (lambda : len (l1 .rpc .listfunds (spent = True )['outputs' ]) == 2 )
1184+
1185+ first_one = int (time .time ())
1186+ time .sleep (2 )
1187+
1188+ # Do another one, make sure we don't see it if we filter by timestamp.
1189+ bitcoind .rpc .sendtoaddress (addr , amount / 10 ** 8 )
1190+
1191+ bitcoind .generate_block (1 , wait_for_mempool = 1 )
1192+ wait_for (lambda : len (l1 .rpc .listfunds ()['outputs' ]) == 2 )
1193+
1194+ incomes = l1 .rpc .bkpr_listincome (end_time = first_one )['income_events' ]
1195+ assert [i for i in incomes if i ['timestamp' ] > first_one ] == []
0 commit comments