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

Function test_db_dangling_peer_fix

tests/test_db.py:17–34  ·  view source on GitHub ↗
(node_factory, bitcoind)

Source from the content-addressed store, hash-verified

15
16@unittest.skipIf(TEST_NETWORK != 'regtest', "The DB migration is network specific due to the chain var.")
17def test_db_dangling_peer_fix(node_factory, bitcoind):
18 # Make sure bitcoind doesn't think it's going backwards
19 bitcoind.generate_block(104)
20 # This was taken from test_fail_unconfirmed() node.
21 l1 = node_factory.get_node(dbfile='dangling-peer.sqlite3.xz',
22 old_hsmsecret=True,
23 options={'database-upgrade': True})
24 l2 = node_factory.get_node(old_hsmsecret=True)
25
26 # Must match entry in db
27 assert l2.info['id'] == '022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59'
28
29 # This time it should work! (Connect *in* since l1 thinks it has UTXOs
30 # it doesn't have).
31 l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
32 # Make sure l2 has register connection
33 l2.daemon.wait_for_log('Handed peer, entering loop')
34 l2.fundchannel(l1, 200000, wait_for_active=True)
35
36
37@unittest.skipIf(TEST_NETWORK != 'regtest', "Address is network specific")

Callers

nothing calls this directly

Calls 5

generate_blockMethod · 0.80
wait_for_logMethod · 0.80
get_nodeMethod · 0.45
connectMethod · 0.45
fundchannelMethod · 0.45

Tested by

no test coverage detected