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

Function test_anysegwit_close_needs_feature

tests/test_closing.py:3991–4010  ·  view source on GitHub ↗

Rather than have peer reject our shutdown, we should refuse to shutdown toa v1+ address if they don't support it

(node_factory, bitcoind)

Source from the content-addressed store, hash-verified

3989
3990@unittest.skipIf(TEST_NETWORK == 'liquid-regtest', "Uses regtest addresses")
3991def test_anysegwit_close_needs_feature(node_factory, bitcoind):
3992 """Rather than have peer reject our shutdown, we should refuse to shutdown toa v1+ address if they don't support it"""
3993 # L2 says "no option_shutdown_anysegwit"
3994 l1, l2 = node_factory.line_graph(2, opts=[{'may_reconnect': True},
3995 {'may_reconnect': True,
3996 'dev-force-features': -27}])
3997
3998 with pytest.raises(RpcError, match=r'Peer does not allow v1\+ shutdown addresses'):
3999 l1.rpc.close(l2.info['id'], destination='bcrt1pw508d6qejxtdg4y5r3zarvary0c5xw7kw508d6qejxtdg4y5r3zarvary0c5xw7k0ylj56')
4000
4001 # From TFM: "Tell your friends to upgrade!"
4002 l2.stop()
4003 del l2.daemon.opts['dev-force-features']
4004 l2.start()
4005
4006 # Now it will work!
4007 l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
4008 l1.rpc.close(l2.info['id'], destination='bcrt1pw508d6qejxtdg4y5r3zarvary0c5xw7kw508d6qejxtdg4y5r3zarvary0c5xw7k0ylj56')
4009 wait_for(lambda: only_one(l1.rpc.listpeerchannels()['channels'])['state'] == 'CLOSINGD_COMPLETE')
4010 bitcoind.generate_block(1, wait_for_mempool=1)
4011
4012
4013def test_close_feerate_range(node_factory, bitcoind, chainparams):

Callers

nothing calls this directly

Calls 9

wait_forFunction · 0.90
only_oneFunction · 0.90
line_graphMethod · 0.80
listpeerchannelsMethod · 0.80
generate_blockMethod · 0.80
closeMethod · 0.45
stopMethod · 0.45
startMethod · 0.45
connectMethod · 0.45

Tested by

no test coverage detected