mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-23 00:54:20 +01:00
test_lightning.py: check error on too-large funding tx.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
904a3e4ae3
commit
fc151e10cd
@@ -2419,6 +2419,31 @@ class LightningDTests(BaseLightningDTests):
|
||||
# This works.
|
||||
l1.rpc.fundchannel(l2.info['id'], int(funds/10))
|
||||
|
||||
def test_funding_toolarge(self):
|
||||
"""Try to create a giant channel"""
|
||||
l1 = self.node_factory.get_node()
|
||||
l2 = self.node_factory.get_node()
|
||||
l1.rpc.connect(l2.info['id'], 'localhost', l2.info['port'])
|
||||
|
||||
# Send funds.
|
||||
amount = 2**24
|
||||
bitcoind.rpc.sendtoaddress(l1.rpc.newaddr()['address'], amount / 10**8 + 0.01)
|
||||
bitcoind.generate_block(1)
|
||||
|
||||
# Wait for it to arrive.
|
||||
wait_for(lambda: len(l1.rpc.listfunds()['outputs']) > 0)
|
||||
|
||||
# Fail to open (too large)
|
||||
try:
|
||||
l1.rpc.fundchannel(l2.info['id'], amount)
|
||||
self.fail('Expected fundchannel to fail!')
|
||||
except ValueError as err:
|
||||
assert 'Funding satoshi must be <= 16777215' in str(err)
|
||||
|
||||
# This should work.
|
||||
amount = amount-1
|
||||
l1.rpc.fundchannel(l2.info['id'], amount)
|
||||
|
||||
def test_addfunds_from_block(self):
|
||||
"""Send funds to the daemon without telling it explicitly
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user