MCPcopy Create free account
hub / github.com/argotorg/solidity / groupChunksBottomUp

Function groupChunksBottomUp

libsolutil/IpfsHash.cpp:144–152  ·  view source on GitHub ↗

Builds a tree starting from the bottom level where nodes are data nodes. Data nodes should be calculated and passed as the only level in chunk levels Each next level is calculated as following: - Pick up to maxChildNum (174) nodes until a whole level is added, group them and pass to the node in the next level - Do this until the current level has only one node, return the hash in that node

Source from the content-addressed store, hash-verified

142/// - Pick up to maxChildNum (174) nodes until a whole level is added, group them and pass to the node in the next level
143/// - Do this until the current level has only one node, return the hash in that node
144bytes groupChunksBottomUp(Chunks _currentLevel)
145{
146 // when we reach root it will be the only node in that level
147 while (_currentLevel.size() != 1)
148 _currentLevel = buildNextLevel(_currentLevel);
149
150 // top level's only node stores the hash for file
151 return _currentLevel.front().hash;
152}
153}
154
155bytes solidity::util::ipfsHash(std::string _data)

Callers 1

ipfsHashMethod · 0.85

Calls 2

buildNextLevelFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected