getBalance from http://goerli.prylabs.net returns very old value #3316
-
Hi Experts, I'm trying to get the balance on my ether Wallet via the Signer.getBalance() method and the value I get is very old. The values is at least about 5 days old. I connect to the provider with: const provider = new ethers.providers.JsonRpcProvider("http://goerli.prylabs.net"); I see the latest and correct balance in Goerli Etherscan portal (https://goerli.etherscan.io/) for the same wallet. But the value I get from the following code is very old. const wallet = new ethers.Wallet(privateKey, provider);
const balance = await wallet.getBalance(); The call to getBalance() does not end up with errors, rather I get wrong (a larger) value back. It's still stranger that when I try to post a new outgoing transaction the balance check is happening correctly from the same provider side and I get the correct errors based on the correct balance. But still the getBalance() returns an incorrect larger value than what is actually available as the balance. How do I get the provider to send me the correct balance with the getBalance() call? Do I have to trigger a sync or force the node to clear its cache every time before the getBalance() call? If yes, how? Thank you for your answers in advance |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 9 replies
-
The provider just passes along the request to the backend. What happens if you query for blockNumber or use getLogs for an even more recent than your balance change? My first guess is that the node has become stale, probably die to a syncing issue? |
Beta Was this translation helpful? Give feedback.
The provider just passes along the request to the backend. What happens if you query for blockNumber or use getLogs for an even more recent than your balance change?
My first guess is that the node has become stale, probably die to a syncing issue?