aboutsummaryrefslogtreecommitdiff
path: root/src/merkleblock.h
diff options
context:
space:
mode:
authorJames O'Beirne <james.obeirne@gmail.com>2017-09-11 17:42:37 -0700
committerJames O'Beirne <james.obeirne@gmail.com>2017-09-20 20:35:54 -0700
commit5ab586f90b74d84e29156ebf6692b9e9055aa047 (patch)
treedf40944f8ec6d4135bb2a610095f1b5d6924548a /src/merkleblock.h
parent3255d6347b1f9eccbec3d6d93d4a424087a3b35b (diff)
Consolidate CMerkleBlock constructor into a single method
Incorporates feedback suggested by @sipa, @promag, @TheBlueMatt.
Diffstat (limited to 'src/merkleblock.h')
-rw-r--r--src/merkleblock.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/merkleblock.h b/src/merkleblock.h
index 20f2b36886..6c05f2c1f8 100644
--- a/src/merkleblock.h
+++ b/src/merkleblock.h
@@ -131,8 +131,12 @@ public:
CBlockHeader header;
CPartialMerkleTree txn;
-public:
- /** Public only for unit testing and relay testing (not relayed) */
+ /**
+ * Public only for unit testing and relay testing (not relayed).
+ *
+ * Used only when a bloom filter is specified to allow
+ * testing the transactions which matched the bloom filter.
+ */
std::vector<std::pair<unsigned int, uint256> > vMatchedTxn;
/**
@@ -140,10 +144,10 @@ public:
* Note that this will call IsRelevantAndUpdate on the filter for each transaction,
* thus the filter will likely be modified.
*/
- CMerkleBlock(const CBlock& block, CBloomFilter& filter);
+ CMerkleBlock(const CBlock& block, CBloomFilter& filter) : CMerkleBlock(block, &filter, nullptr) { }
// Create from a CBlock, matching the txids in the set
- CMerkleBlock(const CBlock& block, const std::set<uint256>& txids);
+ CMerkleBlock(const CBlock& block, const std::set<uint256>& txids) : CMerkleBlock(block, nullptr, &txids) { }
CMerkleBlock() {}
@@ -154,6 +158,10 @@ public:
READWRITE(header);
READWRITE(txn);
}
+
+private:
+ // Combined constructor to consolidate code
+ CMerkleBlock(const CBlock& block, CBloomFilter* filter, const std::set<uint256>* txids);
};
#endif // BITCOIN_MERKLEBLOCK_H