resolve tree caching detection

This commit is contained in:
gozzy 2022-10-28 08:09:02 +00:00
parent c1155ed3ad
commit 7787a8d207

View File

@ -5,6 +5,8 @@ import { download } from '@/store/snark'
import networkConfig from '@/networkConfig' import networkConfig from '@/networkConfig'
import { mimc, bloomService } from '@/services' import { mimc, bloomService } from '@/services'
const supportedCaches = ['1', '56', '100', '137', '5']
class MerkleTreeService { class MerkleTreeService {
constructor({ netId, amount, currency, commitment, instanceName }) { constructor({ netId, amount, currency, commitment, instanceName }) {
this.netId = netId this.netId = netId
@ -153,8 +155,7 @@ class MerkleTreeService {
} }
async getTree() { async getTree() {
const { nativeCurrency } = networkConfig[`netId${this.netId}`] const hasCache = supportedCaches.includes(this.netId.toString())
const hasCache = nativeCurrency === this.currency && Number(this.netId) === 1
let cachedTree = await this.getTreeFromDB() let cachedTree = await this.getTreeFromDB()