Skip to content
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

Merged
merged 16 commits into from
May 11, 2018
Merged

Import Wallet Mnemonic #348

merged 16 commits into from
May 11, 2018

Conversation

mempko
Copy link
Member

@mempko mempko commented May 10, 2018

This PR allows you to import your web wallet to the desktop using the wallet's mnemonic.

mnemonic0

mnemonic1

LogPrintf("Failed to add the referral to the wallet.\n");
return false;
}
//SetUnlockReferralTx(rtx, true);
Copy link
Member

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?

}

bool IsAValidMnemonic(const WordList& words) {
if(words.size() != MNEMONIC_WORD_COUNT) {
Copy link
Member

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

@@ -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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assert(IsValidMnemonic)

@mempko mempko changed the title import Wallet Mnemonic Import Wallet Mnemonic May 11, 2018
@@ -4147,6 +4147,16 @@ UniValue getmnemonic(const JSONRPCRequest& request)
return NullUniValue;
}

if (pwallet->IsLocked()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use EnsureWalletIsUnlocked here

Copy link
Member

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

}

CWalletDB walletdb{*dbw};
walletdb.WriteKeyMetadata(hdkey->second.GetPubKey(), meta);
Copy link
Member

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?

@@ -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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERSION_WITH_SECURE_MNEMONIC?

@tonypizzicato tonypizzicato merged commit a107b6e into master May 11, 2018
@tonypizzicato tonypizzicato deleted the feature/import-mnemonic branch May 11, 2018 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants