aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@protonmail.com>2019-10-23 12:03:57 +0200
committerWladimir J. van der Laan <laanwj@protonmail.com>2019-10-23 12:05:37 +0200
commita884b32854965a6990ef8d8ecccccd91736e0dca (patch)
treeabf5c5f64770b43a9827e219aa4de106680b227b /src
parentceda6e8b747183229696e078c98d6d7a9e8ced10 (diff)
parentcd68594dcdadc195bd2ea9394fa04edfdbdf1149 (diff)
downloadbitcoin-a884b32854965a6990ef8d8ecccccd91736e0dca.tar.xz
Merge #16911: wallet: Only check the hash of transactions loaded from disk
cd68594dcdadc195bd2ea9394fa04edfdbdf1149 Only check the hash of transactions loaded from disk (Andrew Chow) Pull request description: It feels unnecessary to do a full `CheckTransaction` for every transaction saved in the wallet. It should not be possible for an invalid transaction to get into the wallet in the first place, and if there is any disk corruption, the hash check will catch it. ACKs for top commit: MarcoFalke: ACK cd68594dcdadc195bd2ea9394fa04edfdbdf1149 laanwj: ACK cd68594dcdadc195bd2ea9394fa04edfdbdf1149 promag: ACK cd68594dcdadc195bd2ea9394fa04edfdbdf1149, AFAICT the check is not needed, hash comparison gives data integrity. Tree-SHA512: 5b2e719f76097cfbf125392db6cc6c764355c81f0b7a5b60aee4b06af1afcca80cfd38a3cf5307fd9e2c1afc405f8321929a4552943099a8161e6762965451fb
Diffstat (limited to 'src')
-rw-r--r--src/wallet/walletdb.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/wallet/walletdb.cpp b/src/wallet/walletdb.cpp
index d7f7635a83..a9e6763c6d 100644
--- a/src/wallet/walletdb.cpp
+++ b/src/wallet/walletdb.cpp
@@ -5,8 +5,6 @@
#include <wallet/walletdb.h>
-#include <consensus/tx_check.h>
-#include <consensus/validation.h>
#include <fs.h>
#include <key_io.h>
#include <protocol.h>
@@ -218,8 +216,7 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
ssKey >> hash;
CWalletTx wtx(nullptr /* pwallet */, MakeTransactionRef());
ssValue >> wtx;
- CValidationState state;
- if (!(CheckTransaction(*wtx.tx, state) && (wtx.GetHash() == hash) && state.IsValid()))
+ if (wtx.GetHash() != hash)
return false;
// Undo serialize changes in 31600