From fa006fd2f70738cf6381bdc8cf308917e187b3f4 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 4 Nov 2020 11:44:38 +1030 Subject: [PATCH] pyln-testing: require bitcoin v0.20 for PSBT handling, and create wallet for v0.21 With older bitcoind, PSBTs fail: ``` def test_utxopsbt(node_factory, bitcoind, chainparams): ... > psbt = bitcoind.rpc.decodepsbt(funding['psbt']) tests/test_wallet.py:561: ... self = , service_name = 'decodepsbt' args = ('cHNidP8BADMCAAAAAaoMihSVXlpdBHGcJePiroqtwq/b1zu09j8IkTG4OKs7AQAAAAD9////AGYAAAAAAQDeAgAAAAABAefqB6BkZE1/AqXaf36T02a7.../7Stf971PEgvUXgvASECXPTIO6tIVxDih6tfKy6suj6WJhhjycwoaTeuso/AQ8llAAAAAQEfQEIPAAAAAAAWABQB+tkKvNZml+JZIWRyLeSpXr7hZQA=',) postdata = '{"version": "1.1", "method": "decodepsbt", "params": ["cHNidP8BADMCAAAAAaoMihSVXlpdBHGcJePiroqtwq/b1zu09j8IkTG4OKs7AQ...gvUXgvASECXPTIO6tIVxDih6tfKy6suj6WJhhjycwoaTeuso/AQ8llAAAAAQEfQEIPAAAAAAAWABQB+tkKvNZml+JZIWRyLeSpXr7hZQA="], "id": 1}' headers = {'Authorization': b'Basic cnBjdXNlcjpycGNwYXNz', 'Content-type': 'application/json', 'Host': 'localhost', 'User-Agent': 'AuthServiceProxy/0.1'} response = {'error': {'code': -22, 'message': 'TX decode failed PSBT is not sane.: iostream error'}, 'id': 1, 'result': None} ``` Signed-off-by: Rusty Russell Changelog-Changed: *** Requires bitcoind v0.20.1 or above *** --- contrib/pyln-testing/pyln/testing/fixtures.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/contrib/pyln-testing/pyln/testing/fixtures.py b/contrib/pyln-testing/pyln/testing/fixtures.py index 077f9982594e..ea6ccdc5f1b6 100644 --- a/contrib/pyln-testing/pyln/testing/fixtures.py +++ b/contrib/pyln-testing/pyln/testing/fixtures.py @@ -127,9 +127,15 @@ def bitcoind(directory, teardown_checks): info = bitcoind.rpc.getnetworkinfo() - if info['version'] < 160000: + # FIXME: include liquid-regtest in this check after elementsd has been + # updated + if info['version'] < 200100 and env('TEST_NETWORK') != 'liquid-regtest': bitcoind.rpc.stop() - raise ValueError("bitcoind is too old. At least version 16000 (v0.16.0)" + raise ValueError("bitcoind is too old. At least version 20100 (v0.20.1)" + " is needed, current version is {}".format(info['version'])) + elif info['version'] < 160000: + bitcoind.rpc.stop() + raise ValueError("elementsd is too old. At least version 160000 (v0.16.0)" " is needed, current version is {}".format(info['version'])) info = bitcoind.rpc.getblockchaininfo()