Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wallet.getBalance() is unreliable in production #31

Closed
ghost opened this issue Jul 16, 2017 · 0 comments
Closed

wallet.getBalance() is unreliable in production #31

ghost opened this issue Jul 16, 2017 · 0 comments

Comments

@ghost
Copy link

ghost commented Jul 16, 2017

I'm using the following code on both the local machine (dev server) and on the remote server (AWS Lightsail). When I'm developing locally everything works perfectly, but when the code runs on the remote server getBalance method ocasionally returns 0 (~3 out of 10 requests).

I added loggers to getResult and perform functions in json-rpc-provider.
Input to perform never changes (address and blocktag are always the same)
When a promise resolves to 0, output of getResult is Object {jsonrpc: "2.0", id: 42, result: "0x0"}

const testnet = true
const providerToken = '...'
const privateKey = '...'

const provider = new ethers.providers.InfuraProvider(testnet, providerToken)
const wallet = new ethers.Wallet(privateKey, provider )

wallet.getBalance()
  .then(balance => { console.log(balance.toString() }) // logs 0 ocasionally (3 out of 10 requests)

Any idea what is going on?

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants