From b25cc627a3a44378696bb04f1c5ee4c002963d3e Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Wed, 25 Jan 2012 03:05:16 +0100 Subject: [PATCH] Check consistency of private keys Reported by onlineproof on IRC: Bitcoin does not verify whether private keys and public keys correspond, when loading a wallet. --- src/db.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/db.cpp b/src/db.cpp index 8ca78316..9ad05ba7 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -862,6 +862,8 @@ int CWalletDB::LoadWallet(CWallet* pwallet) ssValue >> pkey; key.SetPubKey(vchPubKey); key.SetPrivKey(pkey); + if (key.GetPubKey() != vchPubKey) + return DB_CORRUPT; } else {