From: tobtoht Date: Mon, 24 Mar 2025 04:50:32 +0000 (+0100) Subject: seed: check legacy checksum X-Git-Url: https://git.nutra.tk/v1?a=commitdiff_plain;h=249183f0c1146163ebf84ade67a29daefab15db1;p=gamesguru%2Ffeather.git seed: check legacy checksum --- diff --git a/src/utils/Seed.cpp b/src/utils/Seed.cpp index 9522f5ad..9396cb35 100644 --- a/src/utils/Seed.cpp +++ b/src/utils/Seed.cpp @@ -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 #include @@ -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) {