public BaselineTreeNode[] GetHistoricalLeaves(BaselineTree tree, uint[] leafIndexes, long blockNumber) { if (_logger.IsWarn) { _logger.Warn( $"Retrieving historical leaves of {tree} with index {string.Join(", ", leafIndexes)} for block {blockNumber}"); } var historicalCount = tree.GetBlockCount(blockNumber); BaselineTreeNode[] leaves = new BaselineTreeNode[leafIndexes.Length]; for (int i = 0; i < leafIndexes.Length; i++) { var leafIndex = leafIndexes[i]; if (historicalCount <= leafIndex) { leaves[i] = new BaselineTreeNode(Keccak.Zero, leafIndex); } else { leaves[i] = tree.GetLeaf(leafIndex); } } return(leaves); }
public BaselineTreeNode GetHistoricalLeaf(BaselineTree tree, uint leafIndex, long blockNumber) { if (_logger.IsWarn) { _logger.Warn($"Retrieving historical leaf of {tree} with index {leafIndex} for block {blockNumber}"); } var historicalCount = tree.GetBlockCount(blockNumber); if (historicalCount <= leafIndex) { return(new BaselineTreeNode(Keccak.Zero, leafIndex)); } return(tree.GetLeaf(leafIndex)); }