Browse Source

fixes

pull/1141/head
Ethan Buchman 7 years ago
parent
commit
0d7d16005a
4 changed files with 24 additions and 10 deletions
  1. +8
    -6
      node/node.go
  2. +1
    -1
      p2p/switch.go
  3. +12
    -0
      p2p/types.go
  4. +3
    -3
      rpc/core/pipe.go

+ 8
- 6
node/node.go View File

@ -22,7 +22,9 @@ import (
"github.com/tendermint/tendermint/evidence"
mempl "github.com/tendermint/tendermint/mempool"
"github.com/tendermint/tendermint/p2p"
"github.com/tendermint/tendermint/p2p/pex"
"github.com/tendermint/tendermint/p2p/trust"
p2ptypes "github.com/tendermint/tendermint/p2p/types"
"github.com/tendermint/tendermint/proxy"
rpccore "github.com/tendermint/tendermint/rpc/core"
grpccore "github.com/tendermint/tendermint/rpc/grpc"
@ -97,7 +99,7 @@ type Node struct {
// network
sw *p2p.Switch // p2p connections
addrBook *p2p.AddrBook // known peers
addrBook pex.AddrBook // known peers
trustMetricStore *trust.TrustMetricStore // trust metrics for all peers
// services
@ -238,10 +240,10 @@ func NewNode(config *cfg.Config,
sw.AddReactor("EVIDENCE", evidenceReactor)
// Optionally, start the pex reactor
var addrBook *p2p.AddrBook
var addrBook pex.AddrBook
var trustMetricStore *trust.TrustMetricStore
if config.P2P.PexReactor {
addrBook = p2p.NewAddrBook(config.P2P.AddrBookFile(), config.P2P.AddrBookStrict)
addrBook = pex.NewAddrBook(config.P2P.AddrBookFile(), config.P2P.AddrBookStrict)
addrBook.SetLogger(p2pLogger.With("book", config.P2P.AddrBookFile()))
// Get the trust metric history data
@ -256,8 +258,8 @@ func NewNode(config *cfg.Config,
if config.P2P.Seeds != "" {
seeds = strings.Split(config.P2P.Seeds, ",")
}
pexReactor := p2p.NewPEXReactor(addrBook,
&p2p.PEXReactorConfig{Seeds: seeds})
pexReactor := pex.NewPEXReactor(addrBook,
&pex.PEXReactorConfig{Seeds: seeds})
pexReactor.SetLogger(p2pLogger)
sw.AddReactor("PEX", pexReactor)
}
@ -374,7 +376,7 @@ func (n *Node) OnStart() error {
// Generate node PrivKey
// TODO: pass in like priv_val
nodeKey, err := p2p.LoadOrGenNodeKey(n.config.NodeKeyFile())
nodeKey, err := p2ptypes.LoadOrGenNodeKey(n.config.NodeKeyFile())
if err != nil {
return err
}


+ 1
- 1
p2p/switch.go View File

@ -35,7 +35,7 @@ const (
//-----------------------------------------------------------------------------
type AddrBook interface {
AddAddress(addr *types.NetAddress, src *types.NetAddress)
AddAddress(addr *types.NetAddress, src *types.NetAddress) error
}
//-----------------------------------------------------------------------------


+ 12
- 0
p2p/types.go View File

@ -0,0 +1,12 @@
package p2p
import (
"github.com/tendermint/tendermint/p2p/tmconn"
"github.com/tendermint/tendermint/p2p/types"
)
type ID = types.ID
type NodeInfo = types.NodeInfo
type ChannelDescriptor = tmconn.ChannelDescriptor
type ConnectionStatus = tmconn.ConnectionStatus

+ 3
- 3
rpc/core/pipe.go View File

@ -32,7 +32,7 @@ type P2P interface {
NumPeers() (outbound, inbound, dialig int)
NodeInfo() p2p.NodeInfo
IsListening() bool
DialPeersAsync(*p2p.AddrBook, []string, bool) error
DialPeersAsync(p2p.AddrBook, []string, bool) error
}
//----------------------------------------------
@ -54,7 +54,7 @@ var (
// objects
pubKey crypto.PubKey
genDoc *types.GenesisDoc // cache the genesis structure
addrBook *p2p.AddrBook
addrBook p2p.AddrBook
txIndexer txindex.TxIndexer
consensusReactor *consensus.ConsensusReactor
eventBus *types.EventBus // thread safe
@ -94,7 +94,7 @@ func SetGenesisDoc(doc *types.GenesisDoc) {
genDoc = doc
}
func SetAddrBook(book *p2p.AddrBook) {
func SetAddrBook(book p2p.AddrBook) {
addrBook = book
}


Loading…
Cancel
Save