Getpeerinfo issue

+1 vote
I have been able to connect two independent instances running multichaind connected to each other. However, after a few hours, when I run the command for getpeerinfo, the result of the response does not list the peers connected to the network. I tried re-initializing the network by using, "multichaind chain1 -daemon commands", I get IO error, "

ERROR: Couldn't initialize permission database for network chain1. Probably multichaind for this network is already running. Exiting...". This shows that the multichain server is already running on both instances. How can I ensure that the peers are listed in the getpeerinfo?

 

"
asked Nov 27, 2015 by skarred14

1 Answer

+2 votes

Each getpeerinfo shows the P2P peers for that node, so if you have a blockchain running with two nodes, the output for that command on each one should only show the other node. Do you see something different?

answered Nov 29, 2015 by MultiChain
Unless I re-initiate the set up of the nodes, the result of the getpeerinfo is an empty array. Is it possible to save the state, such that each time the connection is re-established for existing nodes, the nodes can be on the same network?
Do you know the peers are still actually connected, i.e. does the block count in getinfo for each peer go up in sync? I am trying to understand if this is a bug in getpeerinfo or if the connections are actually lost.
I believe that the connections are actually lost..the block count is not in sync across the two nodes. It seemed to have been fixed when I tried again upon suspending the state of the two instances and resuming the state
OK, perhaps it was a genuine communications failure? In real-world deployments you would have lots of nodes connected densely to each other, so individual p2p connections would not be critical.
Understood. On the same note, if in the real world scenario, there were a lot of nodes continually sending transactions to one and/or other nodes, how are connections managed?  I mean, lets say there are several parent nodes issuing permissions and sending/receiving transactions - how do we make sure that all of them are in sync (in terms of the block count, height and registry of transactions)? The question arises because, everytime there is a connection failure, the getpeerinfo command returns a blank array. How do I make sure that  when the connection is re-established, the connection between the two or more peers is enabled without having to re-create the entire node architecture
That's one of the things a blockchain is for - resilient synchronization and replication via a unified transaction log - so basically it's all taken care of for you.
Got it! Thats perfect! However, there is one open question. Say, an initial set up has been created with node 1 and node 2, with node 1 being the admin node. If for some reason there is a real connection failure(say if the instances have been suspended or in the real world both nodes are restarted), getpeerinfo would return a blank array. At this point, is there a way to re-establish the connection. I have tried reconnecting node 2 using multichaind chain1@IP Address:Port to the chain1 on node1 - and there is a IO error. Suggestions?
You can't call multichaind again for the same chain if it is already running. However you should be able to use the addnode command in this format:

multichain-cli chain1 addnode 12:34:56:78:9999 add
...