set NodeInfo on switch before starting RPC server

should fix #1199
This commit is contained in:
Ethan Buchman
2018-04-26 23:49:48 -04:00
parent 94e823cc91
commit 593a785ae2

View File

@ -382,16 +382,6 @@ func (n *Node) OnStart() error {
return err
}
// Run the RPC server first
// so we can eg. receive txs for the first block
if n.config.RPC.ListenAddress != "" {
listeners, err := n.startRPC()
if err != nil {
return err
}
n.rpcListeners = listeners
}
// Create & add listener
protocol, address := cmn.ProtocolAndAddress(n.config.P2P.ListenAddress)
l := p2p.NewDefaultListener(protocol, address, n.config.P2P.SkipUPNP, n.Logger.With("module", "p2p"))
@ -412,6 +402,16 @@ func (n *Node) OnStart() error {
// Add ourselves to addrbook to prevent dialing ourselves
n.addrBook.AddOurAddress(nodeInfo.NetAddress())
// Run the RPC server first
// so we can eg. receive txs for the first block
if n.config.RPC.ListenAddress != "" {
listeners, err := n.startRPC()
if err != nil {
return err
}
n.rpcListeners = listeners
}
// Start the switch
err = n.sw.Start()
if err != nil {