Skip to content

Commit

Permalink
Do not skip pushing of vMatch and vHashes in CMerkleBlock (#2826)
Browse files Browse the repository at this point in the history
Even if its a TX type which we don't want in merkle blocks. Wrongfully
omitting the pushes causes invalid partial merkle trees, which in turn
causes SPV nodes to ban us.
  • Loading branch information
codablock committed Apr 4, 2019
1 parent 1225667 commit b0850fa
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/merkleblock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,10 @@ CMerkleBlock::CMerkleBlock(const CBlock& block, CBloomFilter& filter)
for (unsigned int i = 0; i < block.vtx.size(); i++)
{
const auto& tx = *block.vtx[i];
if (tx.nVersion == 3 && !allowedTxTypes.count(tx.nType)) {
continue;
}

const uint256& hash = tx.GetHash();
if (filter.IsRelevantAndUpdate(tx))
bool isAllowedType = tx.nVersion != 3 || allowedTxTypes.count(tx.nType) != 0;

if (isAllowedType && filter.IsRelevantAndUpdate(tx))
{
vMatch.push_back(true);
vMatchedTxn.push_back(std::make_pair(i, hash));
Expand Down

0 comments on commit b0850fa

Please sign in to comment.