mirror of
https://github.com/fluencelabs/tendermint
synced 2025-05-28 21:51:22 +00:00
fixes
This commit is contained in:
parent
5b5cbaa66a
commit
0d7d16005a
14
node/node.go
14
node/node.go
@ -22,7 +22,9 @@ import (
|
|||||||
"github.com/tendermint/tendermint/evidence"
|
"github.com/tendermint/tendermint/evidence"
|
||||||
mempl "github.com/tendermint/tendermint/mempool"
|
mempl "github.com/tendermint/tendermint/mempool"
|
||||||
"github.com/tendermint/tendermint/p2p"
|
"github.com/tendermint/tendermint/p2p"
|
||||||
|
"github.com/tendermint/tendermint/p2p/pex"
|
||||||
"github.com/tendermint/tendermint/p2p/trust"
|
"github.com/tendermint/tendermint/p2p/trust"
|
||||||
|
p2ptypes "github.com/tendermint/tendermint/p2p/types"
|
||||||
"github.com/tendermint/tendermint/proxy"
|
"github.com/tendermint/tendermint/proxy"
|
||||||
rpccore "github.com/tendermint/tendermint/rpc/core"
|
rpccore "github.com/tendermint/tendermint/rpc/core"
|
||||||
grpccore "github.com/tendermint/tendermint/rpc/grpc"
|
grpccore "github.com/tendermint/tendermint/rpc/grpc"
|
||||||
@ -97,7 +99,7 @@ type Node struct {
|
|||||||
|
|
||||||
// network
|
// network
|
||||||
sw *p2p.Switch // p2p connections
|
sw *p2p.Switch // p2p connections
|
||||||
addrBook *p2p.AddrBook // known peers
|
addrBook pex.AddrBook // known peers
|
||||||
trustMetricStore *trust.TrustMetricStore // trust metrics for all peers
|
trustMetricStore *trust.TrustMetricStore // trust metrics for all peers
|
||||||
|
|
||||||
// services
|
// services
|
||||||
@ -238,10 +240,10 @@ func NewNode(config *cfg.Config,
|
|||||||
sw.AddReactor("EVIDENCE", evidenceReactor)
|
sw.AddReactor("EVIDENCE", evidenceReactor)
|
||||||
|
|
||||||
// Optionally, start the pex reactor
|
// Optionally, start the pex reactor
|
||||||
var addrBook *p2p.AddrBook
|
var addrBook pex.AddrBook
|
||||||
var trustMetricStore *trust.TrustMetricStore
|
var trustMetricStore *trust.TrustMetricStore
|
||||||
if config.P2P.PexReactor {
|
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()))
|
addrBook.SetLogger(p2pLogger.With("book", config.P2P.AddrBookFile()))
|
||||||
|
|
||||||
// Get the trust metric history data
|
// Get the trust metric history data
|
||||||
@ -256,8 +258,8 @@ func NewNode(config *cfg.Config,
|
|||||||
if config.P2P.Seeds != "" {
|
if config.P2P.Seeds != "" {
|
||||||
seeds = strings.Split(config.P2P.Seeds, ",")
|
seeds = strings.Split(config.P2P.Seeds, ",")
|
||||||
}
|
}
|
||||||
pexReactor := p2p.NewPEXReactor(addrBook,
|
pexReactor := pex.NewPEXReactor(addrBook,
|
||||||
&p2p.PEXReactorConfig{Seeds: seeds})
|
&pex.PEXReactorConfig{Seeds: seeds})
|
||||||
pexReactor.SetLogger(p2pLogger)
|
pexReactor.SetLogger(p2pLogger)
|
||||||
sw.AddReactor("PEX", pexReactor)
|
sw.AddReactor("PEX", pexReactor)
|
||||||
}
|
}
|
||||||
@ -374,7 +376,7 @@ func (n *Node) OnStart() error {
|
|||||||
|
|
||||||
// Generate node PrivKey
|
// Generate node PrivKey
|
||||||
// TODO: pass in like priv_val
|
// TODO: pass in like priv_val
|
||||||
nodeKey, err := p2p.LoadOrGenNodeKey(n.config.NodeKeyFile())
|
nodeKey, err := p2ptypes.LoadOrGenNodeKey(n.config.NodeKeyFile())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ const (
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
type AddrBook interface {
|
type AddrBook interface {
|
||||||
AddAddress(addr *types.NetAddress, src *types.NetAddress)
|
AddAddress(addr *types.NetAddress, src *types.NetAddress) error
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
12
p2p/types.go
Normal file
12
p2p/types.go
Normal 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
|
@ -32,7 +32,7 @@ type P2P interface {
|
|||||||
NumPeers() (outbound, inbound, dialig int)
|
NumPeers() (outbound, inbound, dialig int)
|
||||||
NodeInfo() p2p.NodeInfo
|
NodeInfo() p2p.NodeInfo
|
||||||
IsListening() bool
|
IsListening() bool
|
||||||
DialPeersAsync(*p2p.AddrBook, []string, bool) error
|
DialPeersAsync(p2p.AddrBook, []string, bool) error
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------
|
//----------------------------------------------
|
||||||
@ -54,7 +54,7 @@ var (
|
|||||||
// objects
|
// objects
|
||||||
pubKey crypto.PubKey
|
pubKey crypto.PubKey
|
||||||
genDoc *types.GenesisDoc // cache the genesis structure
|
genDoc *types.GenesisDoc // cache the genesis structure
|
||||||
addrBook *p2p.AddrBook
|
addrBook p2p.AddrBook
|
||||||
txIndexer txindex.TxIndexer
|
txIndexer txindex.TxIndexer
|
||||||
consensusReactor *consensus.ConsensusReactor
|
consensusReactor *consensus.ConsensusReactor
|
||||||
eventBus *types.EventBus // thread safe
|
eventBus *types.EventBus // thread safe
|
||||||
@ -94,7 +94,7 @@ func SetGenesisDoc(doc *types.GenesisDoc) {
|
|||||||
genDoc = doc
|
genDoc = doc
|
||||||
}
|
}
|
||||||
|
|
||||||
func SetAddrBook(book *p2p.AddrBook) {
|
func SetAddrBook(book p2p.AddrBook) {
|
||||||
addrBook = book
|
addrBook = book
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user