Older version of the merkle branch computation code, for comparison.
| 156 | |
| 157 | // Older version of the merkle branch computation code, for comparison. |
| 158 | static std::vector<uint256> BlockGetMerkleBranch(const CBlock& block, const std::vector<uint256>& vMerkleTree, int nIndex) |
| 159 | { |
| 160 | std::vector<uint256> vMerkleBranch; |
| 161 | int j = 0; |
| 162 | for (int nSize = block.vtx.size(); nSize > 1; nSize = (nSize + 1) / 2) |
| 163 | { |
| 164 | int i = std::min(nIndex^1, nSize-1); |
| 165 | vMerkleBranch.push_back(vMerkleTree[j+i]); |
| 166 | nIndex >>= 1; |
| 167 | j += nSize; |
| 168 | } |
| 169 | return vMerkleBranch; |
| 170 | } |
| 171 | |
| 172 | static inline int ctz(uint32_t i) { |
| 173 | if (i == 0) return 0; |
no test coverage detected