mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-08 11:44:14 +01:00
Merge #16911: wallet: Only check the hash of transactions loaded from disk
cd68594dcdOnly 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: ACKcd68594dcdlaanwj: ACKcd68594dcdpromag: ACKcd68594dcd, AFAICT the check is not needed, hash comparison gives data integrity. Tree-SHA512: 5b2e719f76097cfbf125392db6cc6c764355c81f0b7a5b60aee4b06af1afcca80cfd38a3cf5307fd9e2c1afc405f8321929a4552943099a8161e6762965451fb
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user