Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/wallet/rpc/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,9 +379,7 @@ static RPCHelpMan upgradetohd()
throw JSONRPCError(RPC_WALLET_UNLOCK_NEEDED, "Error: Wallet encrypted but passphrase not supplied to RPC.");
}
} else {
// TODO: get rid of this .c_str() by implementing SecureString::operator=(std::string)
// Alternately, find a way to make request.params[0] mlock()'d to begin with.
secureWalletPassphrase = request.params[2].get_str().c_str();
secureWalletPassphrase = std::string_view{request.params[2].get_str()};
}

SecureString secureMnemonic;
Expand Down
3 changes: 2 additions & 1 deletion test/functional/wallet_upgradetohd.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ def run_test(self):
self.recover_non_hd()

self.log.info("Same mnemonic, same mnemonic passphrase, encrypt wallet on upgrade, should recover all coins after rescan")
walletpass = "111pass222"
# Null characters are allowed in wallet passphrases now
walletpass = "111\0pass222"
assert node.upgradetohd(mnemonic, "", walletpass)
node.stop()
node.wait_until_stopped()
Expand Down
Loading