mirror of
https://github.com/tornadocash/tornado-core.git
synced 2025-06-07 06:02:56 -04:00
process deposit after changing state to prevent reentrancy
This commit is contained in:
parent
1d258715e0
commit
b8d22464e3
1 changed files with 1 additions and 1 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue