Skip to content

Commit e3609cd

Browse files
doc: Update importaddress mention incompatibility with descriptor wallet
1 parent 9e4fbeb commit e3609cd

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

src/wallet/rpc/backup.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,14 +198,15 @@ RPCHelpMan importprivkey()
198198
RPCHelpMan importaddress()
199199
{
200200
return RPCHelpMan{"importaddress",
201-
"\nAdds an address or script (in hex) that can be watched as if it were in your wallet but cannot be used to spend. Requires a new wallet backup.\n"
201+
"\nAdds an address or script (in hex) that can be watched as if it were in your wallet but cannot be used to spend. Requires a new wallet backup.\n"
202202
"\nNote: This call can take over an hour to complete if rescan is true, during that time, other rpc calls\n"
203203
"may report that the imported address exists but related transactions are still missing, leading to temporarily incorrect/bogus balances and unspent outputs until rescan completes.\n"
204204
"If you have the full public key, you should call importpubkey instead of this.\n"
205205
"Hint: use importmulti to import more than one address.\n"
206206
"\nNote: If you import a non-standard raw script in hex form, outputs sending to it will be treated\n"
207207
"as change, and not show up in many RPCs.\n"
208-
"Note: Use \"getwalletinfo\" to query the scanning progress.\n",
208+
"Note: Use \"getwalletinfo\" to query the scanning progress.\n"
209+
"Note: This command is only compatible with legacy wallets. Use \"importdescriptors\" with \"addr(X)\" for descriptor wallets.\n",
209210
{
210211
{"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The Bitcoin address (or hex-encoded script)"},
211212
{"label", RPCArg::Type::STR, RPCArg::Default{""}, "An optional label"},

src/wallet/rpc/util.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ LegacyScriptPubKeyMan& EnsureLegacyScriptPubKeyMan(CWallet& wallet, bool also_cr
101101
spk_man = wallet.GetOrCreateLegacyScriptPubKeyMan();
102102
}
103103
if (!spk_man) {
104-
throw JSONRPCError(RPC_WALLET_ERROR, "This type of wallet does not support this command");
104+
throw JSONRPCError(RPC_WALLET_ERROR, "Only legacy wallets are supported by this command");
105105
}
106106
return *spk_man;
107107
}
@@ -110,7 +110,7 @@ const LegacyScriptPubKeyMan& EnsureConstLegacyScriptPubKeyMan(const CWallet& wal
110110
{
111111
const LegacyScriptPubKeyMan* spk_man = wallet.GetLegacyScriptPubKeyMan();
112112
if (!spk_man) {
113-
throw JSONRPCError(RPC_WALLET_ERROR, "This type of wallet does not support this command");
113+
throw JSONRPCError(RPC_WALLET_ERROR, "Only legacy wallets are supported by this command");
114114
}
115115
return *spk_man;
116116
}

test/functional/wallet_descriptor.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,15 @@ def run_test(self):
9393

9494
# Make sure things are disabled
9595
self.log.info("Test disabled RPCs")
96-
assert_raises_rpc_error(-4, "This type of wallet does not support this command", recv_wrpc.rpc.importprivkey, "cVpF924EspNh8KjYsfhgY96mmxvT6DgdWiTYMtMjuM74hJaU5psW")
97-
assert_raises_rpc_error(-4, "This type of wallet does not support this command", recv_wrpc.rpc.importpubkey, send_wrpc.getaddressinfo(send_wrpc.getnewaddress()))
98-
assert_raises_rpc_error(-4, "This type of wallet does not support this command", recv_wrpc.rpc.importaddress, recv_wrpc.getnewaddress())
99-
assert_raises_rpc_error(-4, "This type of wallet does not support this command", recv_wrpc.rpc.importmulti, [])
100-
assert_raises_rpc_error(-4, "This type of wallet does not support this command", recv_wrpc.rpc.addmultisigaddress, 1, [recv_wrpc.getnewaddress()])
101-
assert_raises_rpc_error(-4, "This type of wallet does not support this command", recv_wrpc.rpc.dumpprivkey, recv_wrpc.getnewaddress())
102-
assert_raises_rpc_error(-4, "This type of wallet does not support this command", recv_wrpc.rpc.dumpwallet, 'wallet.dump')
103-
assert_raises_rpc_error(-4, "This type of wallet does not support this command", recv_wrpc.rpc.importwallet, 'wallet.dump')
104-
assert_raises_rpc_error(-4, "This type of wallet does not support this command", recv_wrpc.rpc.sethdseed)
96+
assert_raises_rpc_error(-4, "Only legacy wallets are supported by this command", recv_wrpc.rpc.importprivkey, "cVpF924EspNh8KjYsfhgY96mmxvT6DgdWiTYMtMjuM74hJaU5psW")
97+
assert_raises_rpc_error(-4, "Only legacy wallets are supported by this command", recv_wrpc.rpc.importpubkey, send_wrpc.getaddressinfo(send_wrpc.getnewaddress()))
98+
assert_raises_rpc_error(-4, "Only legacy wallets are supported by this command", recv_wrpc.rpc.importaddress, recv_wrpc.getnewaddress())
99+
assert_raises_rpc_error(-4, "Only legacy wallets are supported by this command", recv_wrpc.rpc.importmulti, [])
100+
assert_raises_rpc_error(-4, "Only legacy wallets are supported by this command", recv_wrpc.rpc.addmultisigaddress, 1, [recv_wrpc.getnewaddress()])
101+
assert_raises_rpc_error(-4, "Only legacy wallets are supported by this command", recv_wrpc.rpc.dumpprivkey, recv_wrpc.getnewaddress())
102+
assert_raises_rpc_error(-4, "Only legacy wallets are supported by this command", recv_wrpc.rpc.dumpwallet, 'wallet.dump')
103+
assert_raises_rpc_error(-4, "Only legacy wallets are supported by this command", recv_wrpc.rpc.importwallet, 'wallet.dump')
104+
assert_raises_rpc_error(-4, "Only legacy wallets are supported by this command", recv_wrpc.rpc.sethdseed)
105105

106106
self.log.info("Test encryption")
107107
# Get the master fingerprint before encrypt

0 commit comments

Comments
 (0)