FULLFEATURE: Separate serialization tx witness and the rest

This commit is contained in:
Pieter Wuille 2015-05-11 15:52:17 -07:00 committed by Matt Corallo
parent a04ea8a812
commit 663e9bd329
10 changed files with 164 additions and 51 deletions

View file

@ -65,8 +65,12 @@ uint256 CBlock::BuildMerkleTree(bool* fMutated) const
*/
vMerkleTree.clear();
vMerkleTree.reserve(vtx.size() * 2 + 16); // Safe upper bound for the number of total nodes.
for (std::vector<CTransaction>::const_iterator it(vtx.begin()); it != vtx.end(); ++it)
vMerkleTree.push_back(it->GetHash());
for (std::vector<CTransaction>::const_iterator it(vtx.begin()); it != vtx.end(); ++it) {
if (IsBitcoinBlock())
vMerkleTree.push_back(it->GetBitcoinHash());
else
vMerkleTree.push_back(it->GetFullHash());
}
int j = 0;
bool mutated = false;
for (int nSize = vtx.size(); nSize > 1; nSize = (nSize + 1) / 2)