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

Function test_v2_open_sigs_restart_while_dead

tests/test_opening.py:482–521  ·  view source on GitHub ↗
(node_factory, bitcoind)

Source from the content-addressed store, hash-verified

480@unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd doesnt yet support PSBT features we need')
481@pytest.mark.openchannel('v2')
482def test_v2_open_sigs_restart_while_dead(node_factory, bitcoind):
483 # Same thing as above, except the transaction mines
484 # while we're asleep
485 disconnects_1 = ['-WIRE_TX_SIGNATURES']
486 disconnects_2 = ['+WIRE_TX_SIGNATURES']
487
488 l1, l2 = node_factory.get_nodes(2,
489 opts=[{'disconnect': disconnects_1,
490 'may_reconnect': True,
491 'may_fail': True},
492 {'disconnect': disconnects_2,
493 'may_reconnect': True,
494 'may_fail': True}])
495
496 l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
497 amount = 2**24
498 chan_amount = 100000
499 bitcoind.rpc.sendtoaddress(l1.rpc.newaddr()['p2tr'], amount / 10**8 + 0.01)
500 bitcoind.generate_block(1)
501 # Wait for it to arrive.
502 wait_for(lambda: len(l1.rpc.listfunds()['outputs']) > 0)
503
504 # Make a channel happen, with multiple disconnects!
505 with pytest.raises(RpcError):
506 l1.rpc.fundchannel(l2.info['id'], chan_amount)
507
508 l1.daemon.wait_for_log('Broadcasting funding tx')
509 l1.daemon.wait_for_log('sendrawtx exit 0')
510 l2.daemon.wait_for_log('Broadcasting funding tx')
511 l2.daemon.wait_for_log('sendrawtx exit 0')
512
513 l1.stop()
514 l2.stop()
515 bitcoind.generate_block(6)
516 l1.restart()
517 l2.restart()
518
519 # Make sure we're ok.
520 l2.daemon.wait_for_log(r'to CHANNELD_NORMAL')
521 l1.daemon.wait_for_log(r'to CHANNELD_NORMAL')
522
523
524@unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd doesnt yet support PSBT features we need')

Callers

nothing calls this directly

Calls 10

wait_forFunction · 0.90
get_nodesMethod · 0.80
generate_blockMethod · 0.80
wait_for_logMethod · 0.80
restartMethod · 0.80
connectMethod · 0.45
newaddrMethod · 0.45
listfundsMethod · 0.45
fundchannelMethod · 0.45
stopMethod · 0.45

Tested by

no test coverage detected