From 391dff16fe9ace90fc0f3308a5c63c453370e713 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Tue, 11 Aug 2015 21:03:31 +0200 Subject: Do not store Merkle branches in the wallet. Assume that when a wallet transaction has a valid block hash and transaction position in it, the transaction is actually there. We're already trusting wallet data in a much more fundamental way anyway. To prevent backward compatibility issues, a new record is used for storing the block locator in the wallet. Old wallets will see a wallet file synchronized up to the genesis block, and rescan automatically. --- src/primitives/block.h | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src/primitives/block.h') diff --git a/src/primitives/block.h b/src/primitives/block.h index 59f46deb1c..7fe8c84cb7 100644 --- a/src/primitives/block.h +++ b/src/primitives/block.h @@ -77,9 +77,6 @@ public: // network and disk std::vector vtx; - // memory only - mutable std::vector vMerkleTree; - CBlock() { SetNull(); @@ -103,7 +100,6 @@ public: { CBlockHeader::SetNull(); vtx.clear(); - vMerkleTree.clear(); } CBlockHeader GetBlockHeader() const @@ -118,14 +114,12 @@ public: return block; } - // Build the in-memory merkle tree for this block and return the merkle root. + // Build the merkle tree for this block and return the merkle root. // If non-NULL, *mutated is set to whether mutation was detected in the merkle // tree (a duplication of transactions in the block leading to an identical // merkle root). - uint256 BuildMerkleTree(bool* mutated = NULL) const; + uint256 ComputeMerkleRoot(bool* mutated = NULL) const; - std::vector GetMerkleBranch(int nIndex) const; - static uint256 CheckMerkleBranch(uint256 hash, const std::vector& vMerkleBranch, int nIndex); std::string ToString() const; }; -- cgit v1.2.3