-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Import Wallet Mnemonic #348
Conversation
src/wallet/wallet.cpp
Outdated
LogPrintf("Failed to add the referral to the wallet.\n"); | ||
return false; | ||
} | ||
//SetUnlockReferralTx(rtx, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need this comment?
src/crypto/mnemonic/mnemonic.cpp
Outdated
} | ||
|
||
bool IsAValidMnemonic(const WordList& words) { | ||
if(words.size() != MNEMONIC_WORD_COUNT) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return words.size() == MNEMONIC_WORD_COUNT
src/crypto/mnemonic/mnemonic.cpp
Outdated
@@ -69,6 +91,8 @@ namespace mnemonic | |||
|
|||
WordList mnemonic(MNEMONIC_WORD_COUNT); | |||
std::transform(inds.begin(), inds.end(), mnemonic.begin(), [&dict](const int& i) { return dict[i]; }); | |||
|
|||
assert(mnemonic.size() == MNEMONIC_WORD_COUNT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert(IsValidMnemonic)
Mnemonic Encryption
src/wallet/rpcwallet.cpp
Outdated
@@ -4147,6 +4147,16 @@ UniValue getmnemonic(const JSONRPCRequest& request) | |||
return NullUniValue; | |||
} | |||
|
|||
if (pwallet->IsLocked()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use EnsureWalletIsUnlocked
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't even need it here, it's called below
src/wallet/wallet.cpp
Outdated
} | ||
|
||
CWalletDB walletdb{*dbw}; | ||
walletdb.WriteKeyMetadata(hdkey->second.GetPubKey(), meta); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return walletdb.WriteKeyMetadata(hdkey->second.GetPubKey(), meta);
here to check if it was written?
src/wallet/walletdb.h
Outdated
@@ -103,7 +103,7 @@ class CKeyMetadata | |||
static const int VERSION_WITH_HDDATA=10; | |||
static const int VERSION_WITH_MNEMONIC=11; | |||
static const int VERSION_WITH_SECURE_MNEMONIC=12; | |||
static const int CURRENT_VERSION=VERSION_WITH_MNEMONIC; | |||
static const int CURRENT_VERSION=VERSION_WITH_HDDATA; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VERSION_WITH_SECURE_MNEMONIC
?
This PR allows you to import your web wallet to the desktop using the wallet's mnemonic.