Do not strip quotes when verifying mnemonic seed.
This commit is contained in:
parent
551072165a
commit
399ed5b4d7
|
@ -32,7 +32,7 @@ class WalletImportExportTest (BitcoinTestFramework):
|
|||
errorString = e.error['message']
|
||||
assert_equal("Error: Please acknowledge that you have backed up" in errorString, True)
|
||||
dump_path0 = self.nodes[0].z_exportwallet('walletdumpmnem')
|
||||
(mnemonic, t_keys0, sprout_keys0, sapling_keys0) = parse_wallet_file(dump_path0)
|
||||
(mnemonic, _, _, _) = parse_wallet_file(dump_path0)
|
||||
self.nodes[0].walletconfirmbackup(mnemonic)
|
||||
|
||||
# Now that we've confirmed backup, we can generate addresses
|
||||
|
@ -81,7 +81,7 @@ def parse_wallet_file(dump_path):
|
|||
assert_true("recovery_phrase" in file_lines[5], "Expected emergency recovery phrase")
|
||||
assert_true("language" in file_lines[6], "Expected mnemonic seed language")
|
||||
assert_true("fingerprint" in file_lines[7], "Expected mnemonic seed fingerprint")
|
||||
mnemonic = file_lines[5].split("=")[1].strip()
|
||||
mnemonic = file_lines[5].split("=")[1].replace("\"", "").strip()
|
||||
(t_keys, i) = parse_wallet_file_lines(file_lines, 0)
|
||||
(sprout_keys, i) = parse_wallet_file_lines(file_lines, i)
|
||||
(sapling_keys, i) = parse_wallet_file_lines(file_lines, i)
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
|
||||
#include <boost/assign/list_of.hpp>
|
||||
#include <boost/algorithm/string/trim.hpp>
|
||||
#include <boost/algorithm/string/erase.hpp>
|
||||
#include <utf8.h>
|
||||
|
||||
#include <univalue.h>
|
||||
|
@ -1764,20 +1763,14 @@ UniValue walletconfirmbackup(const UniValue& params, bool fHelp)
|
|||
EnsureWalletIsUnlocked();
|
||||
|
||||
SecureString strMnemonicPhrase(params[0].get_str());
|
||||
boost::erase_all(strMnemonicPhrase, "\"");
|
||||
boost::trim(strMnemonicPhrase);
|
||||
if (strMnemonicPhrase.length() > 0) {
|
||||
if (!pwalletMain->VerifyMnemonicSeed(strMnemonicPhrase))
|
||||
throw JSONRPCError(
|
||||
RPC_WALLET_PASSPHRASE_INCORRECT,
|
||||
"Error: The emergency recovery phrase entered was incorrect.");
|
||||
if (pwalletMain->VerifyMnemonicSeed(strMnemonicPhrase)) {
|
||||
return NullUniValue;
|
||||
} else {
|
||||
throw runtime_error(
|
||||
"walletconfirmbackup \"emergency recovery phrase\"\n"
|
||||
"Notify the wallet that the user has backed up the emergency recovery phrase");
|
||||
throw JSONRPCError(
|
||||
RPC_WALLET_PASSPHRASE_INCORRECT,
|
||||
"Error: The emergency recovery phrase entered was incorrect.");
|
||||
}
|
||||
|
||||
return NullUniValue;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -42,7 +42,6 @@ EXPECTED_BOOST_INCLUDES=(
|
|||
boost/algorithm/string.hpp
|
||||
boost/algorithm/string/case_conv.hpp
|
||||
boost/algorithm/string/classification.hpp
|
||||
boost/algorithm/string/erase.hpp
|
||||
boost/algorithm/string/join.hpp
|
||||
boost/algorithm/string/predicate.hpp
|
||||
boost/algorithm/string/replace.hpp
|
||||
|
|
Loading…
Reference in New Issue