mirror of
https://github.com/wownero/wowlet.git
synced 2026-10-29 12:18:44 +01:00
FeatherSeed: allow erasure
This commit is contained in:
@@ -7,8 +7,10 @@
|
||||
|
||||
#include <QLineEdit>
|
||||
#include <QPlainTextEdit>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include <monero_seed/wordlist.hpp> // tevador 14 word
|
||||
#include "utils/FeatherSeed.h"
|
||||
|
||||
RestorePage::RestorePage(AppContext *ctx, QWidget *parent) :
|
||||
QWizardPage(parent),
|
||||
@@ -29,6 +31,10 @@ RestorePage::RestorePage(AppContext *ctx, QWidget *parent) :
|
||||
for(int i = 0; i != 2048; i++)
|
||||
m_words14 << QString::fromStdString(wordlist::english.get_word(i));
|
||||
|
||||
// Restore has limited error correction capability, namely it can correct a single erasure
|
||||
// (illegible word with a known location). This can be tested by replacing a word with xxxx
|
||||
m_words14 << "xxxx";
|
||||
|
||||
//
|
||||
m_completer14Model = new QStringListModel(m_words14, m_completer14);
|
||||
m_completer14 = new QCompleter(this);
|
||||
@@ -127,13 +133,6 @@ bool RestorePage::validatePage() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
auto _seed = FeatherSeed::fromSeed(m_ctx->restoreHeights[m_ctx->networkType], m_ctx->coinName.toStdString(), m_ctx->seedLanguage, seed.toStdString());
|
||||
restoreHeight = _seed.restoreHeight;
|
||||
|
||||
this->setField("restoreHeight", restoreHeight);
|
||||
this->setField("mnemonicRestoredSeed", seed);
|
||||
return true;
|
||||
} else if(m_mode == 25) {
|
||||
if(seedSplit.length() != 25) {
|
||||
ui->label_errorString->show();
|
||||
@@ -150,15 +149,22 @@ bool RestorePage::validatePage() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
auto _seed = FeatherSeed::fromSeed(m_ctx->restoreHeights[m_ctx->networkType], m_ctx->coinName.toStdString(), m_ctx->seedLanguage, seed.toStdString());
|
||||
_seed.setRestoreHeight(restoreHeight);
|
||||
this->setField("restoreHeight", restoreHeight);
|
||||
this->setField("mnemonicSeed", seed);
|
||||
this->setField("mnemonicRestoredSeed", seed);
|
||||
return true;
|
||||
}
|
||||
|
||||
ui->seedEdit->setStyleSheet(errStyle);
|
||||
return false;
|
||||
auto _seed = FeatherSeed(m_ctx->restoreHeights[m_ctx->networkType], m_ctx->coinName, m_ctx->seedLanguage, seedSplit);
|
||||
if (!_seed.errorString.isEmpty()) {
|
||||
QMessageBox::warning(this, "Invalid seed", QString("Invalid seed:\n\n%1").arg(_seed.errorString));
|
||||
ui->seedEdit->setStyleSheet(errStyle);
|
||||
return false;
|
||||
}
|
||||
if (!_seed.correction.isEmpty()) {
|
||||
QMessageBox::information(this, "Corrected erasure", QString("xxxx -> %1").arg(_seed.correction));
|
||||
}
|
||||
|
||||
restoreHeight = _seed.restoreHeight;
|
||||
|
||||
this->setField("restoreHeight", restoreHeight);
|
||||
this->setField("mnemonicSeed", seed);
|
||||
this->setField("mnemonicRestoredSeed", seed);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user