pytest: Require bitcoin-0.16.0 and reduce number of generated blocks

0.16.0 is required since we rely on it for some tests and the block
reduction allows us to waste less time during setup. 121 blocks were
chosen so that we have at least one mature output to spend.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
Christian Decker 2018-02-28 12:03:48 +01:00 committed by Rusty Russell
parent 136a5f2b74
commit 565059a12f

View File

@ -50,11 +50,18 @@ def setupBitcoind(directory):
teardown_bitcoind() teardown_bitcoind()
raise raise
info = bitcoind.rpc.getnetworkinfo()
if info['version'] < 160000:
bitcoind.rpc.stop()
raise ValueError("bitcoind is too old. At least version 16000 (v0.16.0)"
" is needed, current version is {}".format(info['version']))
info = bitcoind.rpc.getblockchaininfo() info = bitcoind.rpc.getblockchaininfo()
# Make sure we have segwit and some funds # Make sure we have segwit and some funds
if info['blocks'] < 432: if info['blocks'] < 121:
logging.debug("SegWit not active, generating some more blocks") logging.debug("SegWit not active, generating some more blocks")
bitcoind.generate_block(432 - info['blocks']) bitcoind.generate_block(121 - info['blocks'])
elif bitcoind.rpc.getwalletinfo()['balance'] < 1: elif bitcoind.rpc.getwalletinfo()['balance'] < 1:
logging.debug("Insufficient balance, generating 1 block") logging.debug("Insufficient balance, generating 1 block")
bitcoind.generate_block(1) bitcoind.generate_block(1)
@ -3326,10 +3333,10 @@ class LightningDTests(BaseLightningDTests):
l2.daemon.start() l2.daemon.start()
# Now they should sync and re-establish again # Now they should sync and re-establish again
l1.daemon.wait_for_logs(['Received channel_update for channel 434:1:1.1.', l1.daemon.wait_for_logs(['Received channel_update for channel \\d+:1:1.1.',
'Received channel_update for channel 434:1:1.0.']) 'Received channel_update for channel \\d+:1:1.0.'])
l2.daemon.wait_for_logs(['Received channel_update for channel 434:1:1.1.', l2.daemon.wait_for_logs(['Received channel_update for channel \\d+:1:1.1.',
'Received channel_update for channel 434:1:1.0.']) 'Received channel_update for channel \\d+:1:1.0.'])
wait_for(lambda: [c['active'] for c in l1.rpc.listchannels()['channels']] == [True, True]) wait_for(lambda: [c['active'] for c in l1.rpc.listchannels()['channels']] == [True, True])
@unittest.skipIf(not DEVELOPER, "needs DEVELOPER=1") @unittest.skipIf(not DEVELOPER, "needs DEVELOPER=1")