aboutsummaryrefslogtreecommitdiff
path: root/src/main.h
diff options
context:
space:
mode:
authorMatt Corallo <git@bluematt.me>2012-08-18 23:40:00 -0400
committerMatt Corallo <git@bluematt.me>2013-01-16 12:48:02 -0500
commit9fb106e7579831b4ab682d2e6f588662d0f445d0 (patch)
treef08eadab83d918bb98bdc732f2b973f5ba48afe1 /src/main.h
parent587f0f855ebeb888bdcff68b51fc11fa9aa204b9 (diff)
Add a CMerkleBlock to store merkle branches of filtered txes.
Diffstat (limited to 'src/main.h')
-rw-r--r--src/main.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/main.h b/src/main.h
index d2329af09a..77aac71d22 100644
--- a/src/main.h
+++ b/src/main.h
@@ -2039,4 +2039,34 @@ struct CBlockTemplate
std::vector<int64_t> vTxSigOps;
};
+
+
+
+
+
+/** Used to relay blocks as header + vector<merkle branch>
+ * to filtered nodes.
+ */
+class CMerkleBlock
+{
+public:
+ CBlockHeader header;
+
+ // We could optimize this a bit to deduplicate partial branches,
+ // but it's not worth much unless a node has a ton of txes in a single block
+ // tx index , tx hash, merkle branch
+ std::vector<boost::tuple<unsigned int, uint256, std::vector<uint256> > > vtx;
+
+ // Create from a CBlock, filtering transactions according to filter
+ // 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);
+
+ IMPLEMENT_SERIALIZE
+ (
+ READWRITE(header);
+ READWRITE(vtx);
+ )
+};
+
#endif