aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAndrew Chow <github@achow101.com>2022-12-20 18:05:53 -0500
committerAndrew Chow <github@achow101.com>2022-12-20 18:12:08 -0500
commit8456bfac6ba2dcca42a03d3374c12e1a3f009106 (patch)
tree32045084b1c78e15d570b9622a21d19e46864de8 /test
parentcbcad79eefd741fcfa0fb45615b6030575310f62 (diff)
parent17554efb6095f6ec273e52568efe1678253cb7c0 (diff)
downloadbitcoin-8456bfac6ba2dcca42a03d3374c12e1a3f009106.tar.xz
Merge bitcoin/bitcoin#26638: test: prefer sqlite for wallet tests
17554efb6095f6ec273e52568efe1678253cb7c0 test: prefer sqlite for wallet tests (S3RK) 8e0fabaabf8f45b82256c1934c2507d03351acaa test: make wallet_migration.py pass with both wallet flags (S3RK) Pull request description: Fixes #26511 ACKs for top commit: MarcoFalke: review ACK 17554efb6095f6ec273e52568efe1678253cb7c0 achow101: ACK 17554efb6095f6ec273e52568efe1678253cb7c0 Tree-SHA512: 97cae275998f07032feffe1b533d4747b8ff03c3c1fb830af69ee38cadb75fd58532956f66f79c0d275b00620ce53b0b5240f885e4f29b8bd4d0b6e6cbc683fa
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/test_framework/test_framework.py8
-rwxr-xr-xtest/functional/wallet_migration.py30
2 files changed, 14 insertions, 24 deletions
diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py
index 7cfeae3ff6..a3f2bae2d9 100755
--- a/test/functional/test_framework/test_framework.py
+++ b/test/functional/test_framework/test_framework.py
@@ -214,11 +214,11 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
self.options.descriptors = None
elif self.options.descriptors is None:
# Some wallet is either required or optionally used by the test.
- # Prefer BDB unless it isn't available
- if self.is_bdb_compiled():
- self.options.descriptors = False
- elif self.is_sqlite_compiled():
+ # Prefer SQLite unless it isn't available
+ if self.is_sqlite_compiled():
self.options.descriptors = True
+ elif self.is_bdb_compiled():
+ self.options.descriptors = False
else:
# If neither are compiled, tests requiring a wallet will be skipped and the value of self.options.descriptors won't matter
# It still needs to exist and be None in order for tests to work however.
diff --git a/test/functional/wallet_migration.py b/test/functional/wallet_migration.py
index 37625e50d8..2997372bab 100755
--- a/test/functional/wallet_migration.py
+++ b/test/functional/wallet_migration.py
@@ -40,11 +40,13 @@ class WalletMigrationTest(BitcoinTestFramework):
assert_equal(file_magic, b'SQLite format 3\x00')
assert_equal(self.nodes[0].get_wallet_rpc(wallet_name).getwalletinfo()["format"], "sqlite")
- def create_legacy_wallet(self, wallet_name):
- self.nodes[0].createwallet(wallet_name=wallet_name)
+ def create_legacy_wallet(self, wallet_name, disable_private_keys=False):
+ self.nodes[0].createwallet(wallet_name=wallet_name, descriptors=False, disable_private_keys=disable_private_keys)
wallet = self.nodes[0].get_wallet_rpc(wallet_name)
- assert_equal(wallet.getwalletinfo()["descriptors"], False)
- assert_equal(wallet.getwalletinfo()["format"], "bdb")
+ info = wallet.getwalletinfo()
+ assert_equal(info["descriptors"], False)
+ assert_equal(info["format"], "bdb")
+ assert_equal(info["private_keys_enabled"], not disable_private_keys)
return wallet
def assert_addr_info_equal(self, addr_info, addr_info_old):
@@ -187,11 +189,9 @@ class WalletMigrationTest(BitcoinTestFramework):
# Some keys in multisig do not belong to this wallet
self.log.info("Test migration of a wallet that has some keys in a multisig")
- self.nodes[0].createwallet(wallet_name="multisig1")
- multisig1 = self.nodes[0].get_wallet_rpc("multisig1")
+ multisig1 = self.create_legacy_wallet("multisig1")
ms_info = multisig1.addmultisigaddress(2, [multisig1.getnewaddress(), pub1, pub2])
ms_info2 = multisig1.addmultisigaddress(2, [multisig1.getnewaddress(), pub1, pub2])
- assert_equal(multisig1.getwalletinfo()["descriptors"], False)
addr1 = ms_info["address"]
addr2 = ms_info2["address"]
@@ -256,9 +256,7 @@ class WalletMigrationTest(BitcoinTestFramework):
# Wallet with an imported address. Should be the same thing as the multisig test
self.log.info("Test migration of a wallet with watchonly imports")
- self.nodes[0].createwallet(wallet_name="imports0")
- imports0 = self.nodes[0].get_wallet_rpc("imports0")
- assert_equal(imports0.getwalletinfo()["descriptors"], False)
+ imports0 = self.create_legacy_wallet("imports0")
# Exteranl address label
imports0.setlabel(default.getnewaddress(), "external")
@@ -318,11 +316,7 @@ class WalletMigrationTest(BitcoinTestFramework):
# Migrating an actual watchonly wallet should not create a new watchonly wallet
self.log.info("Test migration of a pure watchonly wallet")
- self.nodes[0].createwallet(wallet_name="watchonly0", disable_private_keys=True)
- watchonly0 = self.nodes[0].get_wallet_rpc("watchonly0")
- info = watchonly0.getwalletinfo()
- assert_equal(info["descriptors"], False)
- assert_equal(info["private_keys_enabled"], False)
+ watchonly0 = self.create_legacy_wallet("watchonly0", disable_private_keys=True)
addr = default.getnewaddress()
desc = default.getaddressinfo(addr)["desc"]
@@ -345,11 +339,7 @@ class WalletMigrationTest(BitcoinTestFramework):
# Migrating a wallet with pubkeys added to the keypool
self.log.info("Test migration of a pure watchonly wallet with pubkeys in keypool")
- self.nodes[0].createwallet(wallet_name="watchonly1", disable_private_keys=True)
- watchonly1 = self.nodes[0].get_wallet_rpc("watchonly1")
- info = watchonly1.getwalletinfo()
- assert_equal(info["descriptors"], False)
- assert_equal(info["private_keys_enabled"], False)
+ watchonly1 = self.create_legacy_wallet("watchonly1", disable_private_keys=True)
addr1 = default.getnewaddress(address_type="bech32")
addr2 = default.getnewaddress(address_type="bech32")