From 490ecc4f0d22059f9f8b3574cb6cce0901a10ed3 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Wed, 28 Feb 2018 12:03:14 +0100 Subject: [PATCH 1/5] contrib: Updated builder image to include v0.16.0 of bitcoind Now that 0.16.0 is stable we should make use of it Signed-off-by: Christian Decker --- contrib/Dockerfile.builder | 7 ++++--- contrib/Dockerfile.builder.i386 | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/contrib/Dockerfile.builder b/contrib/Dockerfile.builder index 4b6f83552710..bf00f6579522 100644 --- a/contrib/Dockerfile.builder +++ b/contrib/Dockerfile.builder @@ -2,6 +2,7 @@ FROM ubuntu:16.04 MAINTAINER Christian Decker ENV DEBIAN_FRONTEND noninteractive +ENV BITCOIN_VERSION 0.16.0 WORKDIR /build RUN apt-get -qq update && \ @@ -30,10 +31,10 @@ RUN apt-get -qq update && \ rm -rf /var/lib/apt/lists/* RUN cd /tmp/ && \ - wget https://bitcoin.org/bin/bitcoin-core-0.15.1/bitcoin-0.15.1-x86_64-linux-gnu.tar.gz -O bitcoin.tar.gz && \ + wget https://bitcoin.org/bin/bitcoin-core-$BITCOIN_VERSION/bitcoin-$BITCOIN_VERSION-x86_64-linux-gnu.tar.gz -O bitcoin.tar.gz && \ tar -xvzf bitcoin.tar.gz && \ - mv /tmp/bitcoin-0.15.1/bin/bitcoin* /usr/local/bin/ && \ - rm -rf bitcoin.tar.gz /tmp/bitcoin-0.15.1 + mv /tmp/bitcoin-$BITCOIN_VERSION/bin/bitcoin* /usr/local/bin/ && \ + rm -rf bitcoin.tar.gz /tmp/bitcoin-$BITCOIN_VERSION RUN pip3 install --upgrade pip && \ pip3 install python-bitcoinlib==0.7.0 pytest==3.0.5 setuptools==36.6.0 pytest-test-groups==1.0.3 flake8==3.5.0 pytest-rerunfailures==3.1 diff --git a/contrib/Dockerfile.builder.i386 b/contrib/Dockerfile.builder.i386 index 79ebfa00a90c..7f4b9d517aa1 100644 --- a/contrib/Dockerfile.builder.i386 +++ b/contrib/Dockerfile.builder.i386 @@ -2,6 +2,7 @@ FROM i386/ubuntu:16.04 MAINTAINER Christian Decker ENV DEBIAN_FRONTEND noninteractive +ENV BITCOIN_VERSION 0.16.0 WORKDIR /build RUN apt-get -qq update && \ @@ -30,10 +31,10 @@ RUN apt-get -qq update && \ rm -rf /var/lib/apt/lists/* RUN cd /tmp/ && \ - wget https://bitcoin.org/bin/bitcoin-core-0.15.1/bitcoin-0.15.1-i686-pc-linux-gnu.tar.gz -O bitcoin.tar.gz && \ + wget https://bitcoin.org/bin/bitcoin-core-$BITCOIN_VERSION/bitcoin-$BITCOIN_VERSION-i686-pc-linux-gnu.tar.gz -O bitcoin.tar.gz && \ tar -xvzf bitcoin.tar.gz && \ - mv /tmp/bitcoin-0.15.1/bin/bitcoin* /usr/local/bin/ && \ - rm -rf bitcoin.tar.gz /tmp/bitcoin-0.15.1 + mv /tmp/bitcoin-$BITCOIN_VERSION/bin/bitcoin* /usr/local/bin/ && \ + rm -rf bitcoin.tar.gz /tmp/bitcoin-$BITCOIN_VERSION RUN pip3 install --upgrade pip && \ pip3 install python-bitcoinlib==0.7.0 pytest==3.0.5 setuptools==36.6.0 pytest-test-groups==1.0.3 flake8==3.5.0 pytest-rerunfailures==3.1 From 3545dab0fba366390518cc7885f75e05c26cb584 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Wed, 28 Feb 2018 12:03:48 +0100 Subject: [PATCH 2/5] 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 --- tests/test_lightningd.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/tests/test_lightningd.py b/tests/test_lightningd.py index 0babf78beb3b..e5537e60e37a 100644 --- a/tests/test_lightningd.py +++ b/tests/test_lightningd.py @@ -50,11 +50,18 @@ def setupBitcoind(directory): teardown_bitcoind() 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() # 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") - bitcoind.generate_block(432 - info['blocks']) + bitcoind.generate_block(121 - info['blocks']) elif bitcoind.rpc.getwalletinfo()['balance'] < 1: logging.debug("Insufficient balance, generating 1 block") bitcoind.generate_block(1) @@ -3326,10 +3333,10 @@ def test_channel_reenable(self): l2.daemon.start() # Now they should sync and re-establish again - l1.daemon.wait_for_logs(['Received channel_update for channel 434:1:1.1.', - 'Received channel_update for channel 434:1:1.0.']) - l2.daemon.wait_for_logs(['Received channel_update for channel 434:1:1.1.', - 'Received channel_update for channel 434:1:1.0.']) + l1.daemon.wait_for_logs(['Received channel_update for channel \\d+:1:1.1.', + 'Received channel_update for channel \\d+:1:1.0.']) + l2.daemon.wait_for_logs(['Received channel_update for channel \\d+:1:1.1.', + 'Received channel_update for channel \\d+:1:1.0.']) wait_for(lambda: [c['active'] for c in l1.rpc.listchannels()['channels']] == [True, True]) @unittest.skipIf(not DEVELOPER, "needs DEVELOPER=1") From 05e4370f44ac1f5dc2efab5ff00e156d4defee09 Mon Sep 17 00:00:00 2001 From: Jan Sarenik Date: Tue, 27 Feb 2018 19:33:09 +0100 Subject: [PATCH 3/5] test_lightningd.py: Enable bech32 test for DEVELOPER Since bitcoind 0.16 is already released it is safe to enable this test already. --- tests/test_lightningd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_lightningd.py b/tests/test_lightningd.py index e5537e60e37a..ddb47c6f4ba6 100644 --- a/tests/test_lightningd.py +++ b/tests/test_lightningd.py @@ -2722,7 +2722,7 @@ def test_closing_negotiation_reconnect(self): l2.daemon.wait_for_logs(['sendrawtx exit 0', ' to CLOSINGD_COMPLETE']) assert l1.bitcoin.rpc.getmempoolinfo()['size'] == 1 - @unittest.skip("FIXME: needs bitcoind 0.16") + @unittest.skipIf(not DEVELOPER, "needs DEVELOPER=1") def test_bech32_funding(self): # Don't get any funds from previous runs. l1 = self.node_factory.get_node(random_hsm=True) From d444d37aa21010493fa6d4b9b461e8ae5d96f5f3 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 1 Mar 2018 10:43:30 +1030 Subject: [PATCH 4/5] test_lightning.py: reduce 121 to 101 blocks, remove segwit comment. FWIW, the tests without valgrind take 662 seconds before we reduced the number of blocks, and only 648 seconds now. Signed-off-by: Rusty Russell --- tests/test_lightningd.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/test_lightningd.py b/tests/test_lightningd.py index ddb47c6f4ba6..35c4a3f017c0 100644 --- a/tests/test_lightningd.py +++ b/tests/test_lightningd.py @@ -58,10 +58,9 @@ def setupBitcoind(directory): " is needed, current version is {}".format(info['version'])) info = bitcoind.rpc.getblockchaininfo() - # Make sure we have segwit and some funds - if info['blocks'] < 121: - logging.debug("SegWit not active, generating some more blocks") - bitcoind.generate_block(121 - info['blocks']) + # Make sure we have some spendable funds + if info['blocks'] < 101: + bitcoind.generate_block(101 - info['blocks']) elif bitcoind.rpc.getwalletinfo()['balance'] < 1: logging.debug("Insufficient balance, generating 1 block") bitcoind.generate_block(1) From 985362c6b6ddb980bf53df9467d21e3d8afe001d Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 1 Mar 2018 10:45:22 +1030 Subject: [PATCH 5/5] README.md: no need for segwit activation on regtest any more. Signed-off-by: Rusty Russell --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 028b43602740..65b68d777b37 100644 --- a/README.md +++ b/README.md @@ -83,8 +83,6 @@ bitcoind -daemon -testnet ``` Wait until `bitcoind` has synchronized with the testnet network. -In case you use regtest, make sure you generate at least 432 blocks to -activate SegWit. Make sure that you do not have `walletbroadcast=0` in your `~/.bitcoin/bitcoin.conf`, or you may run into trouble.