mirror of
https://github.com/tornadocash/tornado-relayer
synced 2024-02-02 15:04:06 +01:00
fix hash map key
This commit is contained in:
parent
16d8e0fc28
commit
e386a1d23c
@ -15,8 +15,7 @@ for (const [key, value] of Object.entries(instances)) {
|
|||||||
const netId = Number(key.substring(5))
|
const netId = Number(key.substring(5))
|
||||||
for (const [currency, { instanceAddress, symbol, decimals }] of Object.entries(value)) {
|
for (const [currency, { instanceAddress, symbol, decimals }] of Object.entries(value)) {
|
||||||
Object.entries(instanceAddress).forEach(([amount, address]) =>
|
Object.entries(instanceAddress).forEach(([amount, address]) =>
|
||||||
addressMap.set(
|
addressMap.set(`${netId}_${address}`,
|
||||||
{ netId, address },
|
|
||||||
{
|
{
|
||||||
currency,
|
currency,
|
||||||
amount,
|
amount,
|
||||||
@ -31,9 +30,9 @@ for (const [key, value] of Object.entries(instances)) {
|
|||||||
const sleep = ms => new Promise(res => setTimeout(res, ms))
|
const sleep = ms => new Promise(res => setTimeout(res, ms))
|
||||||
|
|
||||||
function getInstance(address) {
|
function getInstance(address) {
|
||||||
address = toChecksumAddress(address)
|
const key = `${netId}_${toChecksumAddress(address)}`
|
||||||
if (addressMap.has({ netId, address })) {
|
if (addressMap.has(key)) {
|
||||||
return addressMap.get({ netId, address })
|
return addressMap.get(key)
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Unknown contact address')
|
throw new Error('Unknown contact address')
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user