From b0850fad066087ec1371edcfd55c3806881d1a38 Mon Sep 17 00:00:00 2001 From: Alexander Block Date: Thu, 4 Apr 2019 08:11:04 +0200 Subject: [PATCH] Do not skip pushing of vMatch and vHashes in CMerkleBlock (#2826) 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. --- src/merkleblock.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/merkleblock.cpp b/src/merkleblock.cpp index d9edd382e3504..b2b003f666ffd 100644 --- a/src/merkleblock.cpp +++ b/src/merkleblock.cpp @@ -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));