aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
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.cpp
parent587f0f855ebeb888bdcff68b51fc11fa9aa204b9 (diff)
Add a CMerkleBlock to store merkle branches of filtered txes.
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 93079693c3..bd5b2408a0 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -2239,6 +2239,29 @@ bool ProcessBlock(CNode* pfrom, CBlock* pblock, CDiskBlockPos *dbp)
+CMerkleBlock::CMerkleBlock(const CBlock& block, CBloomFilter& filter)
+{
+ header = block.GetBlockHeader();
+ vtx.reserve(block.vtx.size());
+
+ for(unsigned int i = 0; i < block.vtx.size(); i++)
+ {
+ vector<uint256> branch = block.GetMerkleBranch(i);
+ uint256 hash = block.vtx[i].GetHash();
+ if (filter.IsRelevantAndUpdate(block.vtx[i], hash))
+ {
+ vtx.push_back(make_tuple(i, hash, branch));
+ }
+ }
+}
+
+
+
+
+
+
+
+
bool CheckDiskSpace(uint64 nAdditionalBytes)
{
uint64 nFreeBytesAvailable = filesystem::space(GetDataDir()).available;