Skip to content

Commit

Permalink
Copy addresses before deleting struct
Browse files Browse the repository at this point in the history
  • Loading branch information
yahgwai committed Feb 23, 2022
1 parent 57e0332 commit ef20c7b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions solgen/src/challenge/ChallengeManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -310,11 +310,13 @@ contract ChallengeManager is DelegateCallAware, IChallengeManager {
/// @dev This function causes the mode of the challenge to be set to NONE by deleting the challenge
function _nextWin(uint64 challengeIndex, ChallengeTerminationType reason) private {
ChallengeLib.Challenge storage challenge = challenges[challengeIndex];
address next = challenge.next.addr;
address current = challenge.current.addr;
delete challenges[challengeIndex];
resultReceiver.completeChallenge(
challengeIndex,
challenge.next.addr,
challenge.current.addr
next,
current
);
emit ChallengeEnded(challengeIndex, reason);
}
Expand All @@ -331,6 +333,8 @@ contract ChallengeManager is DelegateCallAware, IChallengeManager {
ChallengeLib.Challenge storage challenge = challenges[challengeIndex];
challenge.challengeStateHash = bytes32(0);

// address next = challenge.next.addr;
// address current = challenge.current.addr;
// delete challenges[challengeIndex];
// resultReceiver.completeChallenge(challengeIndex, challenge.current.addr, challenge.next.addr);
// emit ChallengeEnded(challengeIndex, reason);
Expand Down

0 comments on commit ef20c7b

Please sign in to comment.