seed: check legacy checksum

This commit is contained in:
tobtoht 2025-03-24 05:50:32 +01:00
parent 897afaaabb
commit 249183f0c1
No known key found for this signature in database
GPG key ID: E45B10DD027D2472

View file

@ -7,6 +7,8 @@
#include "monero_seed/monero_seed.hpp"
#include "polyseed/polyseed.h"
#include "utils/AppData.h"
#include "crypto/crypto.h"
#include "mnemonics/electrum-words.h"
#include <sstream>
#include <utility>
@ -132,6 +134,20 @@ Seed::Seed(Type type, QStringList mnemonic, NetworkType::Type networkType)
return;
}
}
if (this->type == Type::MONERO) {
crypto::secret_key recovery_key;
std::string old_language;
if (!crypto::ElectrumWords::words_to_bytes(mnemonic.join(" ").toStdString(), recovery_key, old_language)) {
if (this->mnemonic.length() == 25) {
this->errorString = "Invalid checksum word";
}
else {
this->errorString = "Invalid seed";
}
return;
}
}
}
void Seed::setRestoreHeight(int height) {