mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
More work on peer to peer ledger sync.
This commit is contained in:
@@ -95,6 +95,22 @@ SHAMapNode::SHAMapNode(int depth, const uint256 &hash) : mDepth(depth)
|
||||
mNodeID = getNodeID(depth, hash);
|
||||
}
|
||||
|
||||
SHAMapNode::SHAMapNode(const void *ptr, int len)
|
||||
{
|
||||
if(len<33) mDepth=-1;
|
||||
else
|
||||
{
|
||||
memcpy(&mNodeID, ptr, 32);
|
||||
mDepth=*(reinterpret_cast<const unsigned char *>(ptr) + 32);
|
||||
}
|
||||
}
|
||||
|
||||
void SHAMapNode::addIDRaw(Serializer &s) const
|
||||
{
|
||||
s.add256(mNodeID);
|
||||
s.add1(mDepth);
|
||||
}
|
||||
|
||||
SHAMapNode SHAMapNode::getChildNodeID(int m) const
|
||||
{ // This can be optimized to avoid the << if needed
|
||||
assert((m>=0) && (m<16));
|
||||
|
||||
Reference in New Issue
Block a user