mirror of
https://github.com/tornadocash/tornado-core.git
synced 2025-01-27 04:17:00 -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 {
|
function deposit(uint256 commitment) public payable {
|
||||||
require(isDepositsEnabled, "deposits are disabled");
|
require(isDepositsEnabled, "deposits are disabled");
|
||||||
require(!commitments[commitment], "The commitment has been submitted");
|
require(!commitments[commitment], "The commitment has been submitted");
|
||||||
_processDeposit();
|
|
||||||
_insert(commitment);
|
_insert(commitment);
|
||||||
commitments[commitment] = true;
|
commitments[commitment] = true;
|
||||||
|
_processDeposit();
|
||||||
|
|
||||||
emit Deposit(commitment, next_index - 1, block.timestamp);
|
emit Deposit(commitment, next_index - 1, block.timestamp);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user