mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 15:44:21 +01:00
test_lightning.py: speed up test_closing_different_fees
It was taking over 10 minutes under valgrind, causing Travis to time it out. This shrinks it to its essential tests, and also batches. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
bd1aa935b9
commit
a497a9943d
@@ -982,38 +982,51 @@ class LightningDTests(BaseLightningDTests):
|
|||||||
|
|
||||||
def test_closing_different_fees(self):
|
def test_closing_different_fees(self):
|
||||||
l1 = self.node_factory.get_node()
|
l1 = self.node_factory.get_node()
|
||||||
self.give_funds(l1, (10**6) * 5 + 1000000)
|
|
||||||
|
|
||||||
# Default feerate = 15000/7500/1000
|
# Default feerate = 15000/7500/1000
|
||||||
# It will accept between upper and lower feerate, starting at normal.
|
# It will start at the second number, accepting anything above the first.
|
||||||
for feerates in [ [ 20000, 15000, 7400 ],
|
feerates=[ [ 20000, 15000, 7400 ],
|
||||||
[ 15000, 8000, 1000 ],
|
[ 8000, 1001, 100 ] ]
|
||||||
[ 15000, 6000, 1000 ],
|
amounts = [ 0, 545999, 546000 ]
|
||||||
[ 8000, 7500, 1000 ],
|
num_peers = len(feerates) * len(amounts)
|
||||||
[ 8000, 1200, 100 ] ]:
|
self.give_funds(l1, (10**6) * num_peers + 10000 * num_peers)
|
||||||
# With and without dust
|
|
||||||
for pamount in [ 0, 545999, 546000, 546001, 10**6 // 2 ]:
|
|
||||||
l2 = self.node_factory.get_node(options=['--override-fee-rates={}/{}/{}'
|
|
||||||
.format(feerates[0],
|
|
||||||
feerates[1],
|
|
||||||
feerates[2])])
|
|
||||||
|
|
||||||
l1.rpc.connect(l2.info['id'], 'localhost', l2.info['port'])
|
# Create them in a batch, but only valgrind one in three, for speed!
|
||||||
|
peers = []
|
||||||
|
for feerate in feerates:
|
||||||
|
for amount in amounts:
|
||||||
|
p = self.node_factory.get_node(options=['--override-fee-rates={}/{}/{}'
|
||||||
|
.format(feerate[0],
|
||||||
|
feerate[1],
|
||||||
|
feerate[2])])
|
||||||
|
p.feerate = feerate
|
||||||
|
p.amount = amount
|
||||||
|
l1.rpc.connect(p.info['id'], 'localhost', p.info['port'])
|
||||||
|
peers.append(p)
|
||||||
|
|
||||||
self.fund_channel(l1, l2, 10**6)
|
for p in peers:
|
||||||
if pamount > 0:
|
l1.rpc.fundchannel(p.info['id'], 10**6)
|
||||||
self.pay(l1, l2, pamount)
|
|
||||||
|
|
||||||
l1.rpc.close(l2.info['id'])
|
bitcoind.generate_block(6)
|
||||||
l1.daemon.wait_for_log(' to CHANNELD_SHUTTING_DOWN')
|
|
||||||
l2.daemon.wait_for_log(' to CHANNELD_SHUTTING_DOWN')
|
|
||||||
|
|
||||||
l1.daemon.wait_for_log(' to CLOSINGD_COMPLETE')
|
# Now wait for them all to hit normal state, do payments
|
||||||
l2.daemon.wait_for_log(' to CLOSINGD_COMPLETE')
|
for p in peers:
|
||||||
|
p.daemon.wait_for_log('to CHANNELD_NORMAL')
|
||||||
|
if p.amount != 0:
|
||||||
|
self.pay(l1,p,100000000)
|
||||||
|
|
||||||
bitcoind.generate_block(1)
|
# Now close
|
||||||
l1.daemon.wait_for_log(' to ONCHAIND_MUTUAL')
|
for p in peers:
|
||||||
l2.daemon.wait_for_log(' to ONCHAIND_MUTUAL')
|
l1.rpc.close(p.info['id'])
|
||||||
|
|
||||||
|
for p in peers:
|
||||||
|
p.daemon.wait_for_log(' to CLOSINGD_COMPLETE')
|
||||||
|
|
||||||
|
bitcoind.generate_block(1)
|
||||||
|
for p in peers:
|
||||||
|
p.daemon.wait_for_log(' to ONCHAIND_MUTUAL')
|
||||||
|
|
||||||
|
l1.daemon.wait_for_logs([' to ONCHAIND_MUTUAL'] * num_peers)
|
||||||
|
|
||||||
@unittest.skipIf(not DEVELOPER, "needs DEVELOPER=1")
|
@unittest.skipIf(not DEVELOPER, "needs DEVELOPER=1")
|
||||||
def test_permfail(self):
|
def test_permfail(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user