Browse Source

set NodeInfo on switch before starting RPC server

should fix #1199
pull/1511/head
Ethan Buchman 7 years ago
parent
commit
593a785ae2
1 changed files with 10 additions and 10 deletions
  1. +10
    -10
      node/node.go

+ 10
- 10
node/node.go View File

@ -382,16 +382,6 @@ func (n *Node) OnStart() error {
return err 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 // Create & add listener
protocol, address := cmn.ProtocolAndAddress(n.config.P2P.ListenAddress) protocol, address := cmn.ProtocolAndAddress(n.config.P2P.ListenAddress)
l := p2p.NewDefaultListener(protocol, address, n.config.P2P.SkipUPNP, n.Logger.With("module", "p2p")) 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 // Add ourselves to addrbook to prevent dialing ourselves
n.addrBook.AddOurAddress(nodeInfo.NetAddress()) 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 // Start the switch
err = n.sw.Start() err = n.sw.Start()
if err != nil { if err != nil {


Loading…
Cancel
Save