mirror of
https://github.com/feather-wallet/feather.git
synced 2024-12-22 19:49:28 +00:00
wizard: allow restoring legacy seeds without checksum word
This commit is contained in:
parent
52a69a454e
commit
f8e8deb276
3 changed files with 17 additions and 6 deletions
|
@ -64,9 +64,14 @@ Seed::Seed(Type type, QStringList mnemonic, NetworkType::Type networkType)
|
||||||
: type(type), mnemonic(std::move(mnemonic)), networkType(networkType)
|
: type(type), mnemonic(std::move(mnemonic)), networkType(networkType)
|
||||||
{
|
{
|
||||||
if (m_seedLength[this->type] != this->mnemonic.length()) {
|
if (m_seedLength[this->type] != this->mnemonic.length()) {
|
||||||
|
if (this->type == Seed::Type::MONERO && this->mnemonic.length() == 24) {
|
||||||
|
qDebug() << "Loaded legacy seed without checksum";
|
||||||
|
}
|
||||||
|
else {
|
||||||
this->errorString = "Invalid seed length";
|
this->errorString = "Invalid seed length";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (this->type == Type::POLYSEED) {
|
if (this->type == Type::POLYSEED) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -43,6 +43,7 @@ PageWalletRestoreSeed::PageWalletRestoreSeed(WizardFields *fields, QWidget *pare
|
||||||
for (int i = 0; i != 2048; i++)
|
for (int i = 0; i != 2048; i++)
|
||||||
bip39English << QString::fromStdString(wordlist::english.get_word(i));
|
bip39English << QString::fromStdString(wordlist::english.get_word(i));
|
||||||
|
|
||||||
|
m_polyseed.type = Seed::Type::POLYSEED;
|
||||||
m_polyseed.length = 16;
|
m_polyseed.length = 16;
|
||||||
m_polyseed.setWords(bip39English);
|
m_polyseed.setWords(bip39English);
|
||||||
|
|
||||||
|
@ -50,9 +51,11 @@ PageWalletRestoreSeed::PageWalletRestoreSeed(WizardFields *fields, QWidget *pare
|
||||||
// (illegible word with a known location). This can be tested by replacing a word with xxxx
|
// (illegible word with a known location). This can be tested by replacing a word with xxxx
|
||||||
bip39English << "xxxx";
|
bip39English << "xxxx";
|
||||||
|
|
||||||
|
m_tevador.type = Seed::Type::TEVADOR;
|
||||||
m_tevador.length = 14;
|
m_tevador.length = 14;
|
||||||
m_tevador.setWords(bip39English);
|
m_tevador.setWords(bip39English);
|
||||||
|
|
||||||
|
m_legacy.type = Seed::Type::MONERO;
|
||||||
m_legacy.length = 25;
|
m_legacy.length = 25;
|
||||||
m_legacy.setWords(m_wordlists["English"]);
|
m_legacy.setWords(m_wordlists["English"]);
|
||||||
ui->combo_seedLanguage->setCurrentText("English");
|
ui->combo_seedLanguage->setCurrentText("English");
|
||||||
|
@ -163,11 +166,13 @@ bool PageWalletRestoreSeed::validatePage() {
|
||||||
QStringList seedSplit = seed.split(" ", Qt::SkipEmptyParts);
|
QStringList seedSplit = seed.split(" ", Qt::SkipEmptyParts);
|
||||||
|
|
||||||
if (seedSplit.length() != m_mode->length) {
|
if (seedSplit.length() != m_mode->length) {
|
||||||
|
if (!(m_mode->type == Seed::Type::MONERO && seedSplit.length() == 24)) {
|
||||||
ui->label_errorString->show();
|
ui->label_errorString->show();
|
||||||
ui->label_errorString->setText(QString("The mnemonic seed should be %1 words.").arg(m_mode->length));
|
ui->label_errorString->setText(QString("The mnemonic seed should be %1 words.").arg(m_mode->length));
|
||||||
ui->seedEdit->setStyleSheet(errStyle);
|
ui->seedEdit->setStyleSheet(errStyle);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// libwallet will accept e.g. "brötchen" or "BRÖTCHEN" instead of "Brötchen"
|
// libwallet will accept e.g. "brötchen" or "BRÖTCHEN" instead of "Brötchen"
|
||||||
QStringList lowercaseWords;
|
QStringList lowercaseWords;
|
||||||
|
|
|
@ -46,6 +46,7 @@ private:
|
||||||
QStringList words;
|
QStringList words;
|
||||||
QStringListModel completerModel;
|
QStringListModel completerModel;
|
||||||
QCompleter completer;
|
QCompleter completer;
|
||||||
|
Seed::Type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
void onSeedTypeToggled();
|
void onSeedTypeToggled();
|
||||||
|
|
Loading…
Reference in a new issue