From 073e8cf98b9e04b941d342401814cdc5d985ea14 Mon Sep 17 00:00:00 2001 From: scgbckbone Date: Tue, 7 Nov 2023 13:52:17 +0100 Subject: [PATCH] forgotten BDB cope --- testing/api.py | 2 +- testing/test_export.py | 35 +++++++++++++++++++---------------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/testing/api.py b/testing/api.py index 3d0ad443..9f9b1baf 100644 --- a/testing/api.py +++ b/testing/api.py @@ -203,7 +203,7 @@ def bitcoind_wallet(bitcoind): # Use bitcoind to create a temporary wallet file w_name = 'ckcc-test-wallet-%s' % uuid.uuid4() conn = bitcoind.create_wallet(wallet_name=w_name, disable_private_keys=True, blank=True, - passphrase=None, avoid_reuse=False, descriptors=False) + passphrase=None, avoid_reuse=False, descriptors=not bitcoind.has_bdb) yield conn diff --git a/testing/test_export.py b/testing/test_export.py index e9cd12a4..e6be0bcd 100644 --- a/testing/test_export.py +++ b/testing/test_export.py @@ -22,7 +22,7 @@ from pprint import pprint @pytest.mark.parametrize('way', ["sd", "vdisk", "nfc"]) def test_export_core(way, dev, use_regtest, acct_num, pick_menu_item, goto_home, cap_story, need_keypress, microsd_path, virtdisk_path, bitcoind_wallet, bitcoind_d_wallet, - enter_number, nfc_read_text, load_export): + enter_number, nfc_read_text, load_export, bitcoind): # test UX and operation of the 'bitcoin core' wallet export from pycoin.contrib.segwit_addr import encode as sw_encode use_regtest() @@ -98,21 +98,24 @@ def test_export_core(way, dev, use_regtest, acct_num, pick_menu_item, goto_home, assert expect in desc assert expect+f'/{n}/*' in desc - # test against bitcoind - for x in obj: - x['label'] = 'testcase' - bitcoind_wallet.importmulti(obj) - x = bitcoind_wallet.getaddressinfo(addrs[-1]) - pprint(x) - assert x['address'] == addrs[-1] - if 'label' in x: - # pre 0.21.? - assert x['label'] == 'testcase' - else: - assert x['labels'] == ['testcase'] - assert x['iswatchonly'] == True - assert x['iswitness'] == True - assert x['hdkeypath'] == f"m/84'/1'/{acct_num}'/0/%d" % (len(addrs)-1) + if bitcoind.has_bdb: + # test against bitcoind + # only legacy wallets do support importmulti + for x in obj: + x['label'] = 'testcase' + + bitcoind_wallet.importmulti(obj) + x = bitcoind_wallet.getaddressinfo(addrs[-1]) + pprint(x) + assert x['address'] == addrs[-1] + if 'label' in x: + # pre 0.21.? + assert x['label'] == 'testcase' + else: + assert x['labels'] == ['testcase'] + assert x['iswatchonly'] == True + assert x['iswitness'] == True + assert x['hdkeypath'] == f"m/84'/1'/{acct_num}'/0/%d" % (len(addrs)-1) # importdescriptors -- its better assert imd_js