More SHA map work.

This commit is contained in:
JoelKatz
2011-11-17 19:57:19 -08:00
parent 477b2df276
commit 76b7b3c68e
3 changed files with 68 additions and 19 deletions

View File

@@ -150,6 +150,13 @@ bool SHAMapLeafNode::delItem(const uint256& tag)
return false;
}
SHAMapItem::pointer SHAMapLeafNode::findItem(const uint256& tag)
{
BOOST_FOREACH(SHAMapItem::pointer& it, mItems)
if(it->getTag() == tag) return it;
return SHAMapItem::pointer();
}
SHAMapItem::pointer SHAMapLeafNode::firstItem(void)
{
if(mItems.size()==0) return SHAMapItem::pointer();
@@ -178,6 +185,19 @@ bool SHAMapLeafNode::updateHash(void)
return true;
}
SHAMapInnerNode::SHAMapInnerNode(const SHAMapNode& id) : SHAMapNode(id)
{
;
}
SHAMapInnerNode::SHAMapInnerNode(const SHAMapNode& id, const std::vector<unsigned char>& contents)
: SHAMapNode(id)
{
Serializer s(contents);
for(int i=0; i<32; i++)
mHashes[i]=s.get256(i*32);
}
bool SHAMapInnerNode::setChildHash(int m, const uint256 &hash)
{
assert( (m>=0) && (m<32) );