Skip to content

Commit a00ae31

Browse files
theStackjonatack
andcommitted
rpc: remove deprecated "warning" field from {create,load,restore,unload}wallet
Co-authored-by: Jon Atack <[email protected]>
1 parent 7f20197 commit a00ae31

File tree

3 files changed

+3
-26
lines changed

3 files changed

+3
-26
lines changed

src/wallet/rpc/backup.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1909,7 +1909,6 @@ RPCHelpMan restorewallet()
19091909
RPCResult::Type::OBJ, "", "",
19101910
{
19111911
{RPCResult::Type::STR, "name", "The wallet name if restored successfully."},
1912-
{RPCResult::Type::STR, "warning", /*optional=*/true, "Warning messages, if any, related to restoring the wallet. Multiple messages will be delimited by newlines. (DEPRECATED, returned only if config option -deprecatedrpc=walletwarningfield is passed.)"},
19131912
{RPCResult::Type::ARR, "warnings", /*optional=*/true, "Warning messages, if any, related to restoring the wallet.",
19141913
{
19151914
{RPCResult::Type::STR, "", ""},
@@ -1943,9 +1942,6 @@ RPCHelpMan restorewallet()
19431942

19441943
UniValue obj(UniValue::VOBJ);
19451944
obj.pushKV("name", wallet->GetName());
1946-
if (wallet->chain().rpcEnableDeprecated("walletwarningfield")) {
1947-
obj.pushKV("warning", Join(warnings, Untranslated("\n")).original);
1948-
}
19491945
PushWarnings(warnings, obj);
19501946

19511947
return obj;

src/wallet/rpc/wallet.cpp

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,6 @@ static RPCHelpMan loadwallet()
219219
RPCResult::Type::OBJ, "", "",
220220
{
221221
{RPCResult::Type::STR, "name", "The wallet name if loaded successfully."},
222-
{RPCResult::Type::STR, "warning", /*optional=*/true, "Warning messages, if any, related to loading the wallet. Multiple messages will be delimited by newlines. (DEPRECATED, returned only if config option -deprecatedrpc=walletwarningfield is passed.)"},
223222
{RPCResult::Type::ARR, "warnings", /*optional=*/true, "Warning messages, if any, related to loading the wallet.",
224223
{
225224
{RPCResult::Type::STR, "", ""},
@@ -256,9 +255,6 @@ static RPCHelpMan loadwallet()
256255

257256
UniValue obj(UniValue::VOBJ);
258257
obj.pushKV("name", wallet->GetName());
259-
if (wallet->chain().rpcEnableDeprecated("walletwarningfield")) {
260-
obj.pushKV("warning", Join(warnings, Untranslated("\n")).original);
261-
}
262258
PushWarnings(warnings, obj);
263259

264260
return obj;
@@ -354,7 +350,6 @@ static RPCHelpMan createwallet()
354350
RPCResult::Type::OBJ, "", "",
355351
{
356352
{RPCResult::Type::STR, "name", "The wallet name if created successfully. If the wallet was created using a full path, the wallet_name will be the full path."},
357-
{RPCResult::Type::STR, "warning", /*optional=*/true, "Warning messages, if any, related to creating the wallet. Multiple messages will be delimited by newlines. (DEPRECATED, returned only if config option -deprecatedrpc=walletwarningfield is passed.)"},
358353
{RPCResult::Type::ARR, "warnings", /*optional=*/true, "Warning messages, if any, related to creating the wallet.",
359354
{
360355
{RPCResult::Type::STR, "", ""},
@@ -428,9 +423,6 @@ static RPCHelpMan createwallet()
428423

429424
UniValue obj(UniValue::VOBJ);
430425
obj.pushKV("name", wallet->GetName());
431-
if (wallet->chain().rpcEnableDeprecated("walletwarningfield")) {
432-
obj.pushKV("warning", Join(warnings, Untranslated("\n")).original);
433-
}
434426
PushWarnings(warnings, obj);
435427

436428
return obj;
@@ -448,7 +440,6 @@ static RPCHelpMan unloadwallet()
448440
{"load_on_startup", RPCArg::Type::BOOL, RPCArg::Optional::OMITTED, "Save wallet name to persistent settings and load on startup. True to add wallet to startup list, false to remove, null to leave unchanged."},
449441
},
450442
RPCResult{RPCResult::Type::OBJ, "", "", {
451-
{RPCResult::Type::STR, "warning", /*optional=*/true, "Warning messages, if any, related to unloading the wallet. Multiple messages will be delimited by newlines. (DEPRECATED, returned only if config option -deprecatedrpc=walletwarningfield is passed.)"},
452443
{RPCResult::Type::ARR, "warnings", /*optional=*/true, "Warning messages, if any, related to unloading the wallet.",
453444
{
454445
{RPCResult::Type::STR, "", ""},
@@ -490,13 +481,12 @@ static RPCHelpMan unloadwallet()
490481
throw JSONRPCError(RPC_MISC_ERROR, "Requested wallet already unloaded");
491482
}
492483
}
484+
485+
UnloadWallet(std::move(wallet));
486+
493487
UniValue result(UniValue::VOBJ);
494-
if (wallet->chain().rpcEnableDeprecated("walletwarningfield")) {
495-
result.pushKV("warning", Join(warnings, Untranslated("\n")).original);
496-
}
497488
PushWarnings(warnings, result);
498489

499-
UnloadWallet(std::move(wallet));
500490
return result;
501491
},
502492
};

test/functional/wallet_createwallet.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ def add_options(self, parser):
2525

2626
def set_test_params(self):
2727
self.num_nodes = 1
28-
self.extra_args = [["-deprecatedrpc=walletwarningfield"]]
2928

3029
def skip_test_if_missing_module(self):
3130
self.skip_if_no_wallet()
@@ -164,7 +163,6 @@ def run_test(self):
164163
assert_equal(walletinfo['keypoolsize_hd_internal'], keys)
165164
# Allow empty passphrase, but there should be a warning
166165
resp = self.nodes[0].createwallet(wallet_name='w7', disable_private_keys=False, blank=False, passphrase='')
167-
assert_equal(resp["warning"], EMPTY_PASSPHRASE_MSG if self.options.descriptors else f"{EMPTY_PASSPHRASE_MSG}\n{LEGACY_WALLET_MSG}")
168166
assert_equal(resp["warnings"], [EMPTY_PASSPHRASE_MSG] if self.options.descriptors else [EMPTY_PASSPHRASE_MSG, LEGACY_WALLET_MSG])
169167

170168
w7 = node.get_wallet_rpc('w7')
@@ -184,21 +182,14 @@ def run_test(self):
184182
result = self.nodes[0].createwallet(wallet_name="legacy_w0", descriptors=False, passphrase=None)
185183
assert_equal(result, {
186184
"name": "legacy_w0",
187-
"warning": LEGACY_WALLET_MSG,
188185
"warnings": [LEGACY_WALLET_MSG],
189186
})
190187
result = self.nodes[0].createwallet(wallet_name="legacy_w1", descriptors=False, passphrase="")
191188
assert_equal(result, {
192189
"name": "legacy_w1",
193-
"warning": f"{EMPTY_PASSPHRASE_MSG}\n{LEGACY_WALLET_MSG}",
194190
"warnings": [EMPTY_PASSPHRASE_MSG, LEGACY_WALLET_MSG],
195191
})
196192

197-
self.log.info('Test "warning" field deprecation, i.e. not returned without -deprecatedrpc=walletwarningfield')
198-
self.restart_node(0, extra_args=[])
199-
result = self.nodes[0].createwallet(wallet_name="w7_again", disable_private_keys=False, blank=False, passphrase="")
200-
assert "warning" not in result
201-
202193

203194
if __name__ == '__main__':
204195
CreateWalletTest().main()

0 commit comments

Comments
 (0)