mirror of
https://github.com/tornadocash/tornado-relayer
synced 2024-02-02 15:04:06 +01:00
Check merkle root
This commit is contained in:
parent
1c642a40f1
commit
f7bca08480
5
index.js
5
index.js
@ -42,6 +42,11 @@ app.post('/relay', async (req, resp) => {
|
||||
if (isSpent) {
|
||||
throw new Error('The note has been spent')
|
||||
}
|
||||
const root = publicSignals[0]
|
||||
const isKnownRoot = await mixer.methods.isKnownRoot(root).call()
|
||||
if (!isKnownRoot) {
|
||||
throw new Error('The merkle root is too old or invalid')
|
||||
}
|
||||
const gas = await mixer.methods.withdraw(pi_a, pi_b, pi_c, publicSignals).estimateGas()
|
||||
const result = mixer.methods.withdraw(pi_a, pi_b, pi_c, publicSignals).send({
|
||||
gas: numberToHex(gas + 50000),
|
||||
|
Loading…
Reference in New Issue
Block a user