mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-12 04:41:22 +00:00
p2p: add Channels to NodeInfo and don't send for unknown channels
This commit is contained in:
40
node/node.go
40
node/node.go
@ -18,7 +18,7 @@ import (
|
||||
|
||||
bc "github.com/tendermint/tendermint/blockchain"
|
||||
cfg "github.com/tendermint/tendermint/config"
|
||||
"github.com/tendermint/tendermint/consensus"
|
||||
cs "github.com/tendermint/tendermint/consensus"
|
||||
"github.com/tendermint/tendermint/evidence"
|
||||
mempl "github.com/tendermint/tendermint/mempool"
|
||||
"github.com/tendermint/tendermint/p2p"
|
||||
@ -104,14 +104,14 @@ type Node struct {
|
||||
// services
|
||||
eventBus *types.EventBus // pub/sub for services
|
||||
stateDB dbm.DB
|
||||
blockStore *bc.BlockStore // store the blockchain to disk
|
||||
bcReactor *bc.BlockchainReactor // for fast-syncing
|
||||
mempoolReactor *mempl.MempoolReactor // for gossipping transactions
|
||||
consensusState *consensus.ConsensusState // latest consensus state
|
||||
consensusReactor *consensus.ConsensusReactor // for participating in the consensus
|
||||
evidencePool *evidence.EvidencePool // tracking evidence
|
||||
proxyApp proxy.AppConns // connection to the application
|
||||
rpcListeners []net.Listener // rpc servers
|
||||
blockStore *bc.BlockStore // store the blockchain to disk
|
||||
bcReactor *bc.BlockchainReactor // for fast-syncing
|
||||
mempoolReactor *mempl.MempoolReactor // for gossipping transactions
|
||||
consensusState *cs.ConsensusState // latest consensus state
|
||||
consensusReactor *cs.ConsensusReactor // for participating in the consensus
|
||||
evidencePool *evidence.EvidencePool // tracking evidence
|
||||
proxyApp proxy.AppConns // connection to the application
|
||||
rpcListeners []net.Listener // rpc servers
|
||||
txIndexer txindex.TxIndexer
|
||||
indexerService *txindex.IndexerService
|
||||
}
|
||||
@ -159,7 +159,7 @@ func NewNode(config *cfg.Config,
|
||||
// and sync tendermint and the app by performing a handshake
|
||||
// and replaying any necessary blocks
|
||||
consensusLogger := logger.With("module", "consensus")
|
||||
handshaker := consensus.NewHandshaker(stateDB, state, blockStore)
|
||||
handshaker := cs.NewHandshaker(stateDB, state, blockStore)
|
||||
handshaker.SetLogger(consensusLogger)
|
||||
proxyApp := proxy.NewAppConns(clientCreator, handshaker)
|
||||
proxyApp.SetLogger(logger.With("module", "proxy"))
|
||||
@ -220,13 +220,13 @@ func NewNode(config *cfg.Config,
|
||||
bcReactor.SetLogger(logger.With("module", "blockchain"))
|
||||
|
||||
// Make ConsensusReactor
|
||||
consensusState := consensus.NewConsensusState(config.Consensus, state.Copy(),
|
||||
consensusState := cs.NewConsensusState(config.Consensus, state.Copy(),
|
||||
blockExec, blockStore, mempool, evidencePool)
|
||||
consensusState.SetLogger(consensusLogger)
|
||||
if privValidator != nil {
|
||||
consensusState.SetPrivValidator(privValidator)
|
||||
}
|
||||
consensusReactor := consensus.NewConsensusReactor(consensusState, fastSync)
|
||||
consensusReactor := cs.NewConsensusReactor(consensusState, fastSync)
|
||||
consensusReactor.SetLogger(consensusLogger)
|
||||
|
||||
p2pLogger := logger.With("module", "p2p")
|
||||
@ -503,12 +503,12 @@ func (n *Node) BlockStore() *bc.BlockStore {
|
||||
}
|
||||
|
||||
// ConsensusState returns the Node's ConsensusState.
|
||||
func (n *Node) ConsensusState() *consensus.ConsensusState {
|
||||
func (n *Node) ConsensusState() *cs.ConsensusState {
|
||||
return n.consensusState
|
||||
}
|
||||
|
||||
// ConsensusReactor returns the Node's ConsensusReactor.
|
||||
func (n *Node) ConsensusReactor() *consensus.ConsensusReactor {
|
||||
func (n *Node) ConsensusReactor() *cs.ConsensusReactor {
|
||||
return n.consensusReactor
|
||||
}
|
||||
|
||||
@ -552,16 +552,26 @@ func (n *Node) makeNodeInfo(pubKey crypto.PubKey) p2p.NodeInfo {
|
||||
PubKey: pubKey,
|
||||
Network: n.genesisDoc.ChainID,
|
||||
Version: version.Version,
|
||||
Channels: []byte{
|
||||
bc.BlockchainChannel,
|
||||
cs.StateChannel, cs.DataChannel, cs.VoteChannel, cs.VoteSetBitsChannel,
|
||||
mempl.MempoolChannel,
|
||||
evidence.EvidenceChannel,
|
||||
},
|
||||
Moniker: n.config.Moniker,
|
||||
Other: []string{
|
||||
cmn.Fmt("wire_version=%v", wire.Version),
|
||||
cmn.Fmt("p2p_version=%v", p2p.Version),
|
||||
cmn.Fmt("consensus_version=%v", consensus.Version),
|
||||
cmn.Fmt("consensus_version=%v", cs.Version),
|
||||
cmn.Fmt("rpc_version=%v/%v", rpc.Version, rpccore.Version),
|
||||
cmn.Fmt("tx_index=%v", txIndexerStatus),
|
||||
},
|
||||
}
|
||||
|
||||
if n.config.P2P.PexReactor {
|
||||
nodeInfo.Channels = append(nodeInfo.Channels, pex.PexChannel)
|
||||
}
|
||||
|
||||
rpcListenAddr := n.config.RPC.ListenAddress
|
||||
nodeInfo.Other = append(nodeInfo.Other, cmn.Fmt("rpc_addr=%v", rpcListenAddr))
|
||||
|
||||
|
Reference in New Issue
Block a user