mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 14:08:40 +01:00
Adding assert to avoid a memory access violation inside of PartialMerkleTree::CalcHash()
Adding comment to assert in PartialMerkleTree::CalcHash() Adding comment on CMerkleBlock indicating it calls something that contains an assert Removing EOL whitespace
This commit is contained in:
@@ -59,6 +59,9 @@ CMerkleBlock::CMerkleBlock(const CBlock& block, const std::set<uint256>& txids)
|
||||
}
|
||||
|
||||
uint256 CPartialMerkleTree::CalcHash(int height, unsigned int pos, const std::vector<uint256> &vTxid) {
|
||||
//we can never have zero txs in a merkle block, we always need the coinbase tx
|
||||
//if we do not have this assert, we can hit a memory access violation when indexing into vTxid
|
||||
assert(vTxid.size() != 0);
|
||||
if (height == 0) {
|
||||
// hash at height 0 is the txids themself
|
||||
return vTxid[pos];
|
||||
|
||||
Reference in New Issue
Block a user