pytest: test for blockheight entries in bookkeeper being saved across restart.
What changed, and why it matters
This commit only adds a new test case to the project's test suite. It does not change any production code. The test is currently marked as expected to fail (xfail), meaning it documents a known bug where the bookkeeper plugin does not preserve certain block-height records after a node restart. By itself, this commit does not fix or introduce any security issue.
No immediate security action is required. Treat this as a regression test for a functional/data-integrity bug. If the underlying failure represents a concern, investigate why blockheight entries are lost across restart in the bookkeeper plugin and fix the root cause.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff adds a pytest test, test_listincome_timebox, decorated with @pytest.mark.xfail(strict=True). The test verifies that bkpr_listaccountevents returns identical data before and after a node restart, implying that blockheight entries in the bookkeeper are not being persisted/restored correctly. No application code is modified, so there is no patch to evaluate for security defects.
Changed components
tests/test_bookkeeper.pybookkeeper plugin (tested, not modified)Inspect captured patch +8 / −0
diff --git a/tests/test_bookkeeper.py b/tests/test_bookkeeper.py
index 2beceb84..26930898 100644
--- a/tests/test_bookkeeper.py
+++ b/tests/test_bookkeeper.py
@@ -1164,6 +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()
@@ -1193,3 +1194,10 @@ def test_listincome_timebox(node_factory, bitcoind):
incomes = l1.rpc.bkpr_listincome(end_time=first_one)['income_events']
assert [i for i in incomes if i['timestamp'] > first_one] == []
+
+ # We save blockheights in storage, so make sure we restore them on restart!
+ acctevents_before = l1.rpc.bkpr_listaccountevents()
+ l1.restart()
+
+ acctevents_after = l1.rpc.bkpr_listaccountevents()
+ assert acctevents_after == acctevents_before
Why this scored 11/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.