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) {
|
if (isSpent) {
|
||||||
throw new Error('The note has been spent')
|
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 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({
|
const result = mixer.methods.withdraw(pi_a, pi_b, pi_c, publicSignals).send({
|
||||||
gas: numberToHex(gas + 50000),
|
gas: numberToHex(gas + 50000),
|
||||||
|
Loading…
Reference in New Issue
Block a user