Skip to content

Commit

Permalink
fix: ReducerNode max operation issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Rickk137 committed Feb 13, 2023
1 parent ec86a70 commit 6d2c7ab
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion protocol/oracle-manager/contracts/nodes/ReducerNode.sol
Expand Up @@ -92,7 +92,10 @@ library ReducerNode {
function max(
NodeOutput.Data[] memory parentNodeOutputs
) internal pure returns (NodeOutput.Data memory maxPrice) {
for (uint256 i = 0; i < parentNodeOutputs.length; i++) {
if (parentNodeOutputs.length > 0) {
maxPrice = parentNodeOutputs[0];
}
for (uint256 i = 1; i < parentNodeOutputs.length; i++) {
if (parentNodeOutputs[i].price > maxPrice.price) {
maxPrice = parentNodeOutputs[i];
}
Expand Down

0 comments on commit 6d2c7ab

Please sign in to comment.