mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-26 22:15:52 +00:00
Cache the hash of a SHAMapNode.
This commit is contained in:
@@ -102,15 +102,16 @@ uint256 SHAMapNode::getNodeID(int depth, const uint256& hash)
|
||||
return hash & smMasks[depth];
|
||||
}
|
||||
|
||||
SHAMapNode::SHAMapNode(int depth, const uint256 &hash) : mDepth(depth)
|
||||
SHAMapNode::SHAMapNode(int depth, const uint256 &hash) : mDepth(depth), mHash(0)
|
||||
{ // canonicalize the hash to a node ID for this depth
|
||||
assert((depth >= 0) && (depth < 65));
|
||||
mNodeID = getNodeID(depth, hash);
|
||||
}
|
||||
|
||||
SHAMapNode::SHAMapNode(const void *ptr, int len)
|
||||
SHAMapNode::SHAMapNode(const void *ptr, int len) : mHash(0)
|
||||
{
|
||||
if (len < 33) mDepth = -1;
|
||||
if (len < 33)
|
||||
mDepth = -1;
|
||||
else
|
||||
{
|
||||
memcpy(mNodeID.begin(), ptr, 32);
|
||||
|
||||
Reference in New Issue
Block a user