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

Function test_splice_listnodes

tests/test_splicing.py:445–476  ·  view source on GitHub ↗
(node_factory, bitcoind)

Source from the content-addressed store, hash-verified

443@pytest.mark.openchannel('v2')
444@unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd doesnt yet support PSBT features we need')
445def test_splice_listnodes(node_factory, bitcoind):
446 # Here we do a splice but underfund it purposefully
447 l1, l2 = node_factory.line_graph(2, fundamount=1000000, wait_for_announce=True)
448
449 chan_id = l1.get_channel_id(l2)
450
451 # add extra sats to pay fee
452 funds_result = l1.rpc.fundpsbt("111722sat", 0, 0, excess_as_change=True)
453
454 result = l1.rpc.splice_init(chan_id, 100000, funds_result['psbt'])
455 result = l1.rpc.splice_update(chan_id, result['psbt'])
456 assert(result['commitments_secured'] is False)
457 result = l1.rpc.splice_update(chan_id, result['psbt'])
458 assert(result['commitments_secured'] is True)
459 result = l1.rpc.signpsbt(result['psbt'])
460 result = l1.rpc.splice_signed(chan_id, result['signed_psbt'])
461
462 l2.daemon.wait_for_log(r'CHANNELD_NORMAL to CHANNELD_AWAITING_SPLICE')
463 l1.daemon.wait_for_log(r'CHANNELD_NORMAL to CHANNELD_AWAITING_SPLICE')
464
465 assert len(l1.rpc.listnodes()['nodes']) == 2
466 assert len(l2.rpc.listnodes()['nodes']) == 2
467
468 bitcoind.generate_block(6, wait_for_mempool=1)
469
470 l2.daemon.wait_for_log(r'CHANNELD_AWAITING_SPLICE to CHANNELD_NORMAL')
471 l1.daemon.wait_for_log(r'CHANNELD_AWAITING_SPLICE to CHANNELD_NORMAL')
472
473 bitcoind.generate_block(7)
474
475 wait_for(lambda: len(l1.rpc.listnodes()['nodes']) == 2)
476 wait_for(lambda: len(l2.rpc.listnodes()['nodes']) == 2)
477
478
479@pytest.mark.openchannel('v1')

Callers

nothing calls this directly

Calls 11

wait_forFunction · 0.90
line_graphMethod · 0.80
get_channel_idMethod · 0.80
fundpsbtMethod · 0.80
signpsbtMethod · 0.80
wait_for_logMethod · 0.80
generate_blockMethod · 0.80
splice_initMethod · 0.45
splice_updateMethod · 0.45
splice_signedMethod · 0.45
listnodesMethod · 0.45

Tested by

no test coverage detected