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

Function test_funding_toolarge

tests/test_connection.py:1093–1113  ·  view source on GitHub ↗

Try to create a giant channel

(node_factory, bitcoind)

Source from the content-addressed store, hash-verified

1091@pytest.mark.openchannel('v1')
1092@pytest.mark.openchannel('v2')
1093def test_funding_toolarge(node_factory, bitcoind):
1094 """Try to create a giant channel"""
1095 l1 = node_factory.get_node()
1096 l2 = node_factory.get_node()
1097 l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
1098
1099 # Send funds.
1100 amount = 2**24
1101 bitcoind.rpc.sendtoaddress(l1.rpc.newaddr()['bech32'], amount / 10**8 + 0.01)
1102 bitcoind.generate_block(1)
1103
1104 # Wait for it to arrive.
1105 wait_for(lambda: len(l1.rpc.listfunds()['outputs']) > 0)
1106
1107 # Fail to open (too large)
1108 with pytest.raises(RpcError, match=r'Amount exceeded 16777215'):
1109 l1.rpc.fundchannel(l2.info['id'], amount)
1110
1111 # This should work.
1112 amount = amount - 1
1113 l1.rpc.fundchannel(l2.info['id'], amount)
1114
1115
1116@unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd doesnt yet support PSBT features we need')

Callers

nothing calls this directly

Calls 7

wait_forFunction · 0.90
generate_blockMethod · 0.80
get_nodeMethod · 0.45
connectMethod · 0.45
newaddrMethod · 0.45
listfundsMethod · 0.45
fundchannelMethod · 0.45

Tested by

no test coverage detected