ethrpc icon indicating copy to clipboard operation
ethrpc copied to clipboard

No error when trying to connect to geth, and no peers.

Open gilamran opened this issue 6 years ago • 2 comments

To reproduce:

  • Start geth and make sure there are no peers connected.
  • Run rpc.connect.
  • No error returns. hangs forever.

The issue happens because when trying to do the initial connection you do 3 things in parallel, where the first thing is ensureLatestBlock, and if you look at the code you will see that it fails silently, causing the async.parallel to hang forever.

gilamran avatar Feb 11 '18 12:02 gilamran

I just tried this and was not able to reproduce this issue. ensureLatestBlock should always pull the latest block the Ethereum node has -- even if it hasn't ever connected to any peers, it will still have the genesis block. Can you give me more details about your setup?

  1. What network are you on, and what is the latest blocknumber your geth has on that network?
  2. What command are you using to start geth?
  3. Which version of geth are you using?
  4. What OS are you using?
  5. What is the exact command you're using when you call ethrpc.connect?
  6. Are you using ethrpc from Nodejs (if so, which version?) or a browser (if so, which browser and version?)?

tinybike avatar Feb 11 '18 18:02 tinybike

  1. I'm using the main network, the latest blocknumber is
  2. geth --syncmode "light" --datadir="c:\ethereum\main" --nousb --rpc console
  3. 1.7.3-stable
  4. Windows 10
const rpc = require('ethrpc');
const connectionConfiguration = {
  httpAddresses: ['http://localhost:8545'],
  wsAddresses: [],
  ipcAddresses: []
};

rpc.connect(connectionConfiguration, err => {
  if (err) {
    console.log('Failed to connect to Ethereum node.');
  } else {
    console.log('Connected');
  }
});
  1. I'm using NodeJs version 8.9.0

Some more information:

  • When I type admin.peers on the geth console I get []
  • The connect function hangs because the ensureLastestBlock never calls the callback, To prove that this is the problem, I changed the code and called the callback anyway, and the connect did not hang...
  • ensureLatestBlock failed with the error: no suitable peers available, error: -32000

gilamran avatar Feb 12 '18 16:02 gilamran