Changeset View
Changeset View
Standalone View
Standalone View
test/functional/wallet_multiwallet.py
Show First 20 Lines • Show All 291 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
assert_equal(set(self.nodes[0].listwallets()), set(wallet_names)) | assert_equal(set(self.nodes[0].listwallets()), set(wallet_names)) | ||||
# Fail to load if wallet doesn't exist | # Fail to load if wallet doesn't exist | ||||
assert_raises_rpc_error(-18, 'Wallet wallets not found.', | assert_raises_rpc_error(-18, 'Wallet wallets not found.', | ||||
self.nodes[0].loadwallet, 'wallets') | self.nodes[0].loadwallet, 'wallets') | ||||
# Fail to load duplicate wallets | # Fail to load duplicate wallets | ||||
assert_raises_rpc_error(-4, 'Wallet file verification failed: Error loading wallet w1. Duplicate -wallet filename specified.', | assert_raises_rpc_error( | ||||
self.nodes[0].loadwallet, wallet_names[0]) | -4, | ||||
'Wallet file verification failed. Error loading wallet w1. Duplicate -wallet filename specified.', | |||||
self.nodes[0].loadwallet, | |||||
wallet_names[0]) | |||||
# Fail to load duplicate wallets by different ways (directory and | # Fail to load duplicate wallets by different ways (directory and | ||||
# filepath) | # filepath) | ||||
assert_raises_rpc_error(-4, "Wallet file verification failed: Error loading wallet wallet.dat. Duplicate -wallet filename specified.", | assert_raises_rpc_error( | ||||
self.nodes[0].loadwallet, 'wallet.dat') | -4, | ||||
"Wallet file verification failed. Error loading wallet wallet.dat. Duplicate -wallet filename specified.", | |||||
self.nodes[0].loadwallet, | |||||
'wallet.dat') | |||||
# Fail to load if one wallet is a copy of another | # Fail to load if one wallet is a copy of another | ||||
assert_raises_rpc_error(-1, "BerkeleyBatch: Can't open database w8_copy (duplicates fileid", | assert_raises_rpc_error(-1, "BerkeleyBatch: Can't open database w8_copy (duplicates fileid", | ||||
self.nodes[0].loadwallet, 'w8_copy') | self.nodes[0].loadwallet, 'w8_copy') | ||||
# Fail to load if one wallet is a copy of another. | # Fail to load if one wallet is a copy of another. | ||||
# Test this twice to make sure that we don't re-introduce | # Test this twice to make sure that we don't re-introduce | ||||
# https://github.com/bitcoin/bitcoin/issues/14304 | # https://github.com/bitcoin/bitcoin/issues/14304 | ||||
assert_raises_rpc_error(-1, "BerkeleyBatch: Can't open database w8_copy (duplicates fileid", | assert_raises_rpc_error(-1, "BerkeleyBatch: Can't open database w8_copy (duplicates fileid", | ||||
self.nodes[0].loadwallet, 'w8_copy') | self.nodes[0].loadwallet, 'w8_copy') | ||||
# Fail to load if wallet file is a symlink | # Fail to load if wallet file is a symlink | ||||
if os.name != 'nt': | if os.name != 'nt': | ||||
assert_raises_rpc_error(-4, "Wallet file verification failed: Invalid -wallet path 'w8_symlink'", | assert_raises_rpc_error( | ||||
self.nodes[0].loadwallet, 'w8_symlink') | -4, | ||||
"Wallet file verification failed. Invalid -wallet path 'w8_symlink'", | |||||
self.nodes[0].loadwallet, | |||||
'w8_symlink') | |||||
# Fail to load if a directory is specified that doesn't contain a | # Fail to load if a directory is specified that doesn't contain a | ||||
# wallet | # wallet | ||||
os.mkdir(wallet_dir('empty_wallet_dir')) | os.mkdir(wallet_dir('empty_wallet_dir')) | ||||
assert_raises_rpc_error(-18, "Directory empty_wallet_dir does not contain a wallet.dat file", | assert_raises_rpc_error(-18, "Directory empty_wallet_dir does not contain a wallet.dat file", | ||||
self.nodes[0].loadwallet, 'empty_wallet_dir') | self.nodes[0].loadwallet, 'empty_wallet_dir') | ||||
self.log.info("Test dynamic wallet creation.") | self.log.info("Test dynamic wallet creation.") | ||||
▲ Show 20 Lines • Show All 96 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
self.restart_node( | self.restart_node( | ||||
0, extra_args=[ | 0, extra_args=[ | ||||
'-upgradewallet={}'.format(FEATURE_LATEST)]) | '-upgradewallet={}'.format(FEATURE_LATEST)]) | ||||
assert {'name': 'high_minversion'} in self.nodes[0].listwalletdir()[ | assert {'name': 'high_minversion'} in self.nodes[0].listwalletdir()[ | ||||
'wallets'] | 'wallets'] | ||||
self.log.info("Fail -upgradewallet that results in downgrade") | self.log.info("Fail -upgradewallet that results in downgrade") | ||||
assert_raises_rpc_error( | assert_raises_rpc_error( | ||||
-4, | -4, | ||||
'Wallet loading failed: Error loading {}: Wallet requires newer version of {}'.format( | 'Wallet loading failed. Error loading {}: Wallet requires newer version of {}'.format( | ||||
wallet_dir('high_minversion', 'wallet.dat'), self.config['environment']['PACKAGE_NAME']), | wallet_dir('high_minversion', 'wallet.dat'), self.config['environment']['PACKAGE_NAME']), | ||||
lambda: self.nodes[0].loadwallet(filename='high_minversion'), | lambda: self.nodes[0].loadwallet(filename='high_minversion'), | ||||
) | ) | ||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
MultiWalletTest().main() | MultiWalletTest().main() |