Skip to content

Commit

Permalink
perf: delete response improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
moebius committed Oct 26, 2023
1 parent dd83db0 commit 3eba7b9
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions solidity/contracts/Oracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ contract Oracle is IOracle {

/// @inheritdoc IOracle
function deleteResponse(bytes32 _responseId) external {
Response memory _response = _responses[_responseId];
Request memory _request = _requests[_response.requestId];
Response storage _response = _responses[_responseId];
Request storage _request = _requests[_response.requestId];

if (disputeOf[_responseId] != bytes32(0)) {
revert Oracle_CannotDeleteWhileDisputing(_responseId);
Expand All @@ -217,11 +217,10 @@ contract Oracle is IOracle {
}

_request.responseModule.deleteResponse(_response.requestId, _responseId, msg.sender);

delete _responses[_responseId];
_responseIds[_response.requestId].remove(_responseId);

emit ResponseDeleted(_response.requestId, msg.sender, _responseId);
delete _responses[_responseId];
}

/// @inheritdoc IOracle
Expand Down

0 comments on commit 3eba7b9

Please sign in to comment.