Only include selected TX types into CMerkleBlock (#2737)

It was reported on iOS that CMerkleBlock sometimes included the dummy
quorum commitments introduced with v13, which led to banning of nodes as
these were not supported/expected there.

We should in general only include TXs here that are of interest for SPV
nodes, so we should maintain the list of allowed TX types.
This commit is contained in:
Alexander Block 2019-03-04 07:52:14 +01:00 committed by GitHub
parent f971da8318
commit 4a495c6b4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,10 +19,24 @@ CMerkleBlock::CMerkleBlock(const CBlock& block, CBloomFilter& filter)
vMatch.reserve(block.vtx.size());
vHashes.reserve(block.vtx.size());
const static std::set<int> allowedTxTypes = {
TRANSACTION_NORMAL,
TRANSACTION_PROVIDER_REGISTER,
TRANSACTION_PROVIDER_UPDATE_SERVICE,
TRANSACTION_PROVIDER_UPDATE_REGISTRAR,
TRANSACTION_PROVIDER_UPDATE_REVOKE,
TRANSACTION_COINBASE,
};
for (unsigned int i = 0; i < block.vtx.size(); i++)
{
const uint256& hash = block.vtx[i]->GetHash();
if (filter.IsRelevantAndUpdate(*block.vtx[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))
{
vMatch.push_back(true);
vMatchedTxn.push_back(std::make_pair(i, hash));