MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_bkpr_parallel

Function test_bkpr_parallel

tests/test_bookkeeper.py:1224–1242  ·  view source on GitHub ↗

Bookkeeper could crash with parallel requests

(node_factory, bitcoind, executor)

Source from the content-addressed store, hash-verified

1222@unittest.skipIf(TEST_NETWORK != 'regtest', "Snapshots are bitcoin regtest.")
1223@unittest.skipIf(os.getenv('TEST_DB_PROVIDER', 'sqlite3') != 'sqlite3', "uses snapshots")
1224def test_bkpr_parallel(node_factory, bitcoind, executor):
1225 """Bookkeeper could crash with parallel requests"""
1226 bitcoind.generate_block(1)
1227 l1 = node_factory.get_node(dbfile="l1-before-moves-in-db.sqlite3.xz",
1228 options={'database-upgrade': True},
1229 old_hsmsecret=True)
1230
1231 fut1 = executor.submit(l1.rpc.bkpr_listincome)
1232 fut2 = executor.submit(l1.rpc.bkpr_listincome)
1233
1234 fut1.result()
1235 fut2.result()
1236
1237 # We save blockheights in storage, so make sure we restore them on restart!
1238 acctevents_before = l1.rpc.bkpr_listaccountevents()
1239 l1.restart()
1240
1241 acctevents_after = l1.rpc.bkpr_listaccountevents()
1242 assert acctevents_after == acctevents_before
1243
1244
1245def test_bkpr_report_tags_and_fallback(node_factory):

Callers

nothing calls this directly

Calls 3

generate_blockMethod · 0.80
restartMethod · 0.80
get_nodeMethod · 0.45

Tested by

no test coverage detected