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

Function test_funding_toolarge

tests/test_connection.py:1158–1178  ·  view source on GitHub ↗

Try to create a giant channel

(node_factory, bitcoind)

Source from the content-addressed store, hash-verified

1156@pytest.mark.openchannel('v1')
1157@pytest.mark.openchannel('v2')
1158def test_funding_toolarge(node_factory, bitcoind):
1159 """Try to create a giant channel"""
1160 l1 = node_factory.get_node()
1161 l2 = node_factory.get_node(options={'dev-force-features': '-19'})
1162 l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
1163
1164 # Send funds.
1165 amount = 2**24
1166 bitcoind.rpc.sendtoaddress(l1.rpc.newaddr('bech32')['bech32'], amount / 10**8 + 0.01)
1167 bitcoind.generate_block(1)
1168
1169 # Wait for it to arrive.
1170 wait_for(lambda: len(l1.rpc.listfunds()['outputs']) > 0)
1171
1172 # Fail to open (too large)
1173 with pytest.raises(RpcError, match=r'Amount exceeded 16777215'):
1174 l1.rpc.fundchannel(l2.info['id'], amount)
1175
1176 # This should work.
1177 amount = amount - 1
1178 l1.rpc.fundchannel(l2.info['id'], amount)
1179
1180
1181@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