mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-31 10:56:03 +02:00
Merge #14291: wallet: Add ListWalletDir utility function
d56a068935docs: Add release notes for listwalletdir RPC (João Barbosa)0cb3cad166qa: Add tests for listwalletdir RPC (João Barbosa)cc3377360crpc: Add listwalletdir RPC (João Barbosa)d1b03b8e5finterfaces: Add getWalletDir and listWalletDir to Node (João Barbosa)fc4db35bfdwallet: Add ListWalletDir utility (João Barbosa) Pull request description: `ListWalletDir` returns all available wallets in the current wallet directory. Based on MeshCollider work in pull #11485. Tree-SHA512: 5843e3dbd1e0449f55bb8ea7c241a536078ff6ffcaad88ce5fcf8963971d48c78600fbc4f44919523b8a92329d5d8a5f567a3e0ccb0270fdd27366e19603a716
This commit is contained in:
@@ -38,6 +38,8 @@ class MultiWalletTest(BitcoinTestFramework):
|
||||
return wallet_dir(name, "wallet.dat")
|
||||
return wallet_dir(name)
|
||||
|
||||
assert_equal(self.nodes[0].listwalletdir(), { 'wallets': [{ 'name': '' }] })
|
||||
|
||||
# check wallet.dat is created
|
||||
self.stop_nodes()
|
||||
assert_equal(os.path.isfile(wallet_dir('wallet.dat')), True)
|
||||
@@ -71,6 +73,8 @@ class MultiWalletTest(BitcoinTestFramework):
|
||||
wallet_names.remove('w7_symlink')
|
||||
extra_args = ['-wallet={}'.format(n) for n in wallet_names]
|
||||
self.start_node(0, extra_args)
|
||||
assert_equal(set(map(lambda w: w['name'], self.nodes[0].listwalletdir()['wallets'])), set(['', 'w3', 'w2', 'sub/w5', 'w7', 'w7', 'w1', 'w8', 'w']))
|
||||
|
||||
assert_equal(set(node.listwallets()), set(wallet_names))
|
||||
|
||||
# check that all requested wallets were created
|
||||
@@ -143,6 +147,8 @@ class MultiWalletTest(BitcoinTestFramework):
|
||||
|
||||
self.restart_node(0, extra_args)
|
||||
|
||||
assert_equal(set(map(lambda w: w['name'], self.nodes[0].listwalletdir()['wallets'])), set(['', 'w3', 'w2', 'sub/w5', 'w7', 'w7', 'w8_copy', 'w1', 'w8', 'w']))
|
||||
|
||||
wallets = [wallet(w) for w in wallet_names]
|
||||
wallet_bad = wallet("bad")
|
||||
|
||||
@@ -281,6 +287,8 @@ class MultiWalletTest(BitcoinTestFramework):
|
||||
assert_equal(self.nodes[0].listwallets(), ['w1'])
|
||||
assert_equal(w1.getwalletinfo()['walletname'], 'w1')
|
||||
|
||||
assert_equal(set(map(lambda w: w['name'], self.nodes[0].listwalletdir()['wallets'])), set(['', 'w3', 'w2', 'sub/w5', 'w7', 'w9', 'w7', 'w8_copy', 'w1', 'w8', 'w']))
|
||||
|
||||
# Test backing up and restoring wallets
|
||||
self.log.info("Test wallet backup")
|
||||
self.restart_node(0, ['-nowallet'])
|
||||
|
||||
Reference in New Issue
Block a user