a6739cc868 rpc: Add specific error code for "wallet already loaded" (Wladimir J. van der Laan)
Pull request description:
Add a separate RPC error code for "wallet already loaded" to avoid having to match on message to detect this.
Requested by shesek for rust-bitcoinrpc.
If concept ACKed needs:
- [ ] Release note
- [x] A functional test (updated the existing test to make it pass, I think this is enough)
ACKs for top commit:
jonasschnelli:
Code Review ACK a6739cc868
promag:
Code review ACK a6739cc868.
Tree-SHA512: 9091872e6ea148aec733705d6af330f72a02f23b936b892ac28f9023da7430af6332418048adbee6014305b812316391812039e9180f7f3362d11f206c13b7d0
@ -304,12 +304,12 @@ class MultiWalletTest(BitcoinTestFramework):
ifself.options.descriptors:
ifself.options.descriptors:
assert_raises_rpc_error(-4,"Wallet file verification failed. SQLiteDatabase: Unable to obtain an exclusive lock on the database, is it being used by another bitcoind?",self.nodes[0].loadwallet,wallet_names[0])
assert_raises_rpc_error(-4,"Wallet file verification failed. SQLiteDatabase: Unable to obtain an exclusive lock on the database, is it being used by another bitcoind?",self.nodes[0].loadwallet,wallet_names[0])
else:
else:
assert_raises_rpc_error(-4,"Wallet file verification failed. Refusing to load database. Data file '{}' is already loaded.".format(path),self.nodes[0].loadwallet,wallet_names[0])
assert_raises_rpc_error(-35,"Wallet file verification failed. Refusing to load database. Data file '{}' is already loaded.".format(path),self.nodes[0].loadwallet,wallet_names[0])
# This tests the default wallet that BDB makes, so SQLite wallet doesn't need to test this
# This tests the default wallet that BDB makes, so SQLite wallet doesn't need to test this
# Fail to load duplicate wallets by different ways (directory and filepath)
# Fail to load duplicate wallets by different ways (directory and filepath)
assert_raises_rpc_error(-4,"Wallet file verification failed. Refusing to load database. Data file '{}' is already loaded.".format(path),self.nodes[0].loadwallet,'wallet.dat')
assert_raises_rpc_error(-35,"Wallet file verification failed. Refusing to load database. Data file '{}' is already loaded.".format(path),self.nodes[0].loadwallet,'wallet.dat')
# Only BDB doesn't open duplicate wallet files. SQLite does not have this limitation. While this may be desired in the future, it is not necessary
# Only BDB doesn't open duplicate wallet files. SQLite does not have this limitation. While this may be desired in the future, it is not necessary