Add sanity check after key generation

Add a sanity check to prevent cosmic rays from flipping a bit in the
generated public key, or bugs in the elliptic curve code. This is
simply done by signing a (randomized) message, and verifying the
result.
This commit is contained in:
Pieter Wuille
2014-11-06 01:17:48 -08:00
parent cbf28c6619
commit d0c41a7350
5 changed files with 44 additions and 4 deletions

View File

@@ -79,6 +79,7 @@ CPubKey CWallet::GenerateNewKey()
SetMinVersion(FEATURE_COMPRPUBKEY);
CPubKey pubkey = secret.GetPubKey();
assert(secret.VerifyPubKey(pubkey));
// Create new metadata
int64_t nCreationTime = GetTime();