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

Function buildNextLevel

libsolutil/IpfsHash.cpp:117–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115}
116
117Chunks buildNextLevel(Chunks& _currentLevel)
118{
119 size_t const maxChildNum = 174;
120
121 Chunks nextLevel;
122 Chunks links;
123
124 for (Chunk& chunk: _currentLevel)
125 {
126 links.emplace_back(std::move(chunk.hash), chunk.size, chunk.blockSize);
127 if (links.size() == maxChildNum)
128 {
129 nextLevel.emplace_back(combineLinks(links));
130 links = {};
131 }
132 }
133 if (!links.empty())
134 nextLevel.emplace_back(combineLinks(links));
135
136 return nextLevel;
137}
138
139/// Builds a tree starting from the bottom level where nodes are data nodes.
140/// Data nodes should be calculated and passed as the only level in chunk levels

Callers 1

groupChunksBottomUpFunction · 0.85

Calls 3

combineLinksFunction · 0.85
sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected