diff --git a/src/utils/blockchain.ts b/src/utils/blockchain.ts index 0360a0dd3..d2eddfcd4 100644 --- a/src/utils/blockchain.ts +++ b/src/utils/blockchain.ts @@ -56,7 +56,7 @@ export class Blockchain { } public async isNetworkReady(): Promise { - if (this.networkAvailable || this.provider.ready) { + if (this.networkAvailable && this.provider.ready) { return { ready: true } } return await this.detectNetwork() @@ -73,11 +73,12 @@ export class Blockchain { CORE_LOGGER.error(`Unable to detect provider network: (TIMEOUT)`) resolve({ ready: false, error: 'TIMEOUT' }) }, 3000) + this.provider - ._detectNetwork() - .then((network) => { + .getBlock('latest') + .then((block) => { clearTimeout(timeout) - resolve({ ready: network instanceof Network }) + resolve({ ready: block.hash !== null }) }) .catch((err) => { CORE_LOGGER.error(`Unable to detect provider network: ${err.message}`)