mirror of
https://github.com/tornadocash/tornado-core.git
synced 2025-01-11 21:19:25 -05:00
process deposit after changing state to prevent reentrancy
This commit is contained in:
parent
1d258715e0
commit
b8d22464e3
@ -65,9 +65,9 @@ contract Mixer is MerkleTreeWithHistory {
|
||||
function deposit(uint256 commitment) public payable {
|
||||
require(isDepositsEnabled, "deposits are disabled");
|
||||
require(!commitments[commitment], "The commitment has been submitted");
|
||||
_processDeposit();
|
||||
_insert(commitment);
|
||||
commitments[commitment] = true;
|
||||
_processDeposit();
|
||||
|
||||
emit Deposit(commitment, next_index - 1, block.timestamp);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user