mirror of
https://github.com/tornadocash/tornado-core.git
synced 2025-08-06 22:04:11 -04:00
add isSpendArray view function
This commit is contained in:
parent
f5486f0943
commit
a6cda4a501
2 changed files with 61 additions and 1 deletions
|
@ -95,10 +95,20 @@ contract Mixer is MerkleTreeWithHistory, ReentrancyGuard {
|
|||
function _processWithdraw(address payable _recipient, address payable _relayer, uint256 _fee, uint256 _refund) internal;
|
||||
|
||||
/** @dev whether a note is already spent */
|
||||
function isSpent(bytes32 _nullifierHash) external view returns(bool) {
|
||||
function isSpent(bytes32 _nullifierHash) public view returns(bool) {
|
||||
return nullifierHashes[_nullifierHash];
|
||||
}
|
||||
|
||||
/** @dev whether an array of notes is already spent */
|
||||
function isSpentArray(bytes32[] calldata _nullifierHashes) external view returns(bool[] memory spent) {
|
||||
spent = new bool[](_nullifierHashes.length);
|
||||
for(uint i = 0; i < _nullifierHashes.length; i++) {
|
||||
if (isSpent(_nullifierHashes[i])) {
|
||||
spent[i] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@dev allow operator to update SNARK verification keys. This is needed to update keys after the final trusted setup ceremony is held.
|
||||
After that operator rights are supposed to be transferred to zero address
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue