diff --git a/src/bls/bls.cpp b/src/bls/bls.cpp index bf71b40ff50c..49981ee9190f 100644 --- a/src/bls/bls.cpp +++ b/src/bls/bls.cpp @@ -66,6 +66,9 @@ void CBLSSecretKey::MakeNewKey() GetStrongRandBytes({buf, sizeof(buf)}); try { impl = bls::PrivateKey::FromBytes(bls::Bytes(reinterpret_cast(buf), SerSize)); + if (impl == bls::PrivateKey()) { + continue; + } break; } catch (...) { } diff --git a/src/bls/bls.h b/src/bls/bls.h index 6c3a7f2010e9..19dd5ae7611c 100644 --- a/src/bls/bls.h +++ b/src/bls/bls.h @@ -111,6 +111,11 @@ class CBLSWrapper } else { try { impl = ImplType::FromBytes(bls::Bytes(vecBytes.data(), vecBytes.size()), specificLegacyScheme); + if (impl == ImplType()) { + Reset(); + cachedHash.SetNull(); + return; + } fValid = true; } catch (...) { Reset(); diff --git a/src/qt/networkwidget.cpp b/src/qt/networkwidget.cpp index 774125031b5f..6ff8297f3c7b 100644 --- a/src/qt/networkwidget.cpp +++ b/src/qt/networkwidget.cpp @@ -240,6 +240,7 @@ void NetworkWidget::handleQrDataChanged() it->second.second->setToolTip(tr("Waiting for blockchain sync…")); grid->addWidget(it->second.first, current_row, 0); grid->addWidget(it->second.second, current_row, 1); + needs_reseating = true; } else if (needs_reseating) { grid->removeWidget(it->second.first); grid->removeWidget(it->second.second);