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

Function test_gossip_store_load_amount_truncated

tests/test_gossip.py:1233–1254  ·  view source on GitHub ↗

Make sure we can read canned gossip store with truncated amount

(node_factory)

Source from the content-addressed store, hash-verified

1231
1232
1233def test_gossip_store_load_amount_truncated(node_factory):
1234 """Make sure we can read canned gossip store with truncated amount"""
1235 l1 = node_factory.get_node(start=False, allow_broken_log=True)
1236 with open(os.path.join(l1.daemon.lightning_dir, TEST_NETWORK, 'gossip_store'), 'wb') as f:
1237 f.write(bytearray.fromhex("0a" # GOSSIP_STORE_VERSION
1238 "000001b0" # len
1239 "fea676e8" # csum
1240 "5b8d9b44" # timestamp
1241 "0100" # WIRE_CHANNEL_ANNOUNCEMENT
1242 "bb8d7b6998cca3c2b3ce12a6bd73a8872c808bb48de2a30c5ad9cdf835905d1e27505755087e675fb517bbac6beb227629b694ea68f49d357458327138978ebfd7adfde1c69d0d2f497154256f6d5567a5cf2317c589e0046c0cc2b3e986cf9b6d3b44742bd57bce32d72cd1180a7f657795976130b20508b239976d3d4cdc4d0d6e6fbb9ab6471f664a662972e406f519eab8bce87a8c0365646df5acbc04c91540b4c7c518cec680a4a6af14dae1aca0fd5525220f7f0e96fcd2adef3c803ac9427fe71034b55a50536638820ef21903d09ccddd38396675b598587fa886ca711415c813fc6d69f46552b9a0a539c18f265debd0e2e286980a118ba349c216000043497fd7f826957108f4a30fd9cec3aeba79972084e90ead01ea33090000000013a63c0000b50001021bf3de4e84e3d52f9a3e36fbdcd2c4e8dbf203b9ce4fc07c2f03be6c21d0c67503f113414ebdc6c1fb0f33c99cd5a1d09dd79e7fdf2468cf1fe1af6674361695d203801fd8ab98032f11cc9e4916dd940417082727077609d5c7f8cc6e9a3ad25dd102517164b97ab46cee3826160841a36c46a2b7b9c74da37bdc070ed41ba172033a"))
1243
1244 l1.start()
1245 # May preceed the Started msg waited for in 'start'.
1246 wait_for(lambda: l1.daemon.is_in_log(r'gossip_store: dangling channel_announcement. Moving to gossip_store.corrupt and truncating'))
1247 wait_for(lambda: l1.daemon.is_in_log(r'gossip_store: Read 0/0/0/0 cannounce/cupdate/nannounce/cdelete from store \(0 deleted\) in 1 bytes'))
1248 assert os.path.exists(os.path.join(l1.daemon.lightning_dir, TEST_NETWORK, 'gossip_store.corrupt'))
1249
1250 # Extra sanity check if we can.
1251 if DEVELOPER:
1252 l1.rpc.call('dev-compact-gossip-store')
1253 l1.restart()
1254 l1.rpc.call('dev-compact-gossip-store')
1255
1256
1257@pytest.mark.developer("Needs fast gossip propagation")

Callers

nothing calls this directly

Calls 8

wait_forFunction · 0.90
joinMethod · 0.80
is_in_logMethod · 0.80
restartMethod · 0.80
get_nodeMethod · 0.45
writeMethod · 0.45
startMethod · 0.45
callMethod · 0.45

Tested by

no test coverage detected