Skip to content

Commit a884b32

Browse files
committed
Merge #16911: wallet: Only check the hash of transactions loaded from disk
cd68594 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 cd68594 laanwj: ACK cd68594 promag: ACK cd68594, AFAICT the check is not needed, hash comparison gives data integrity. Tree-SHA512: 5b2e719f76097cfbf125392db6cc6c764355c81f0b7a5b60aee4b06af1afcca80cfd38a3cf5307fd9e2c1afc405f8321929a4552943099a8161e6762965451fb
2 parents ceda6e8 + cd68594 commit a884b32

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/wallet/walletdb.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55

66
#include <wallet/walletdb.h>
77

8-
#include <consensus/tx_check.h>
9-
#include <consensus/validation.h>
108
#include <fs.h>
119
#include <key_io.h>
1210
#include <protocol.h>
@@ -218,8 +216,7 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
218216
ssKey >> hash;
219217
CWalletTx wtx(nullptr /* pwallet */, MakeTransactionRef());
220218
ssValue >> wtx;
221-
CValidationState state;
222-
if (!(CheckTransaction(*wtx.tx, state) && (wtx.GetHash() == hash) && state.IsValid()))
219+
if (wtx.GetHash() != hash)
223220
return false;
224221

225222
// Undo serialize changes in 31600

0 commit comments

Comments
 (0)