Documentation ¶
Index ¶
- Constants
- Variables
- func ReadMsgWithPrependedSize(stream stream.Stream) ([]byte, error)
- func RunDevp2p(state *consensus.ConsensusState, obsvC chan consensus.MsgInfo, ...) func(ctx context.Context) error
- func Send(ctx context.Context, h host.Host, peer peer.ID, topic string, msg interface{}) (stream.Stream, error)
- func SendRPC(ctx context.Context, h host.Host, peer peer.ID, topic string, req interface{}, ...) error
- func SplitAndTrim(input string) (ret []string)
- func WriteMsgWithPrependedSize(stream network.Stream, msg []byte) error
- type BlockSync
- type GetFullBlockRequest
- type GetLatestMessagesRequest
- type GetLatestMessagesResponse
- type HelloRequest
- type HelloResponse
- type PeerHandler
- type Server
Constants ¶
View Source
const ( MsgProposal = 0x01 MsgVote = 0x02 MsgVerifiedBlock = 0x03 MsgHelloRequest = 0x04 MsgHelloResponse = 0x05 TopicHello = "/mpbft/dev/hello/1.0.0" TopicFullBlock = "/mpbft/dev/fullblock/1.0.0" TopicConsensusSync = "/mpbft/dev/consensus_sync/1.0.0" )
Variables ¶
View Source
var TestMode bool
Functions ¶
func SplitAndTrim ¶
SplitAndTrim splits input separated by a comma and trims excessive white space from the substrings.
Types ¶
type BlockSync ¶
type BlockSync struct {
// contains filtered or unexported fields
}
func NewBlockSync ¶
func NewBlockSync(h host.Host, chainState consensus.ChainState, blockStore consensus.BlockStore, executor consensus.BlockExecutor, obsvC chan consensus.MsgInfo) *BlockSync
func (*BlockSync) LastChainState ¶
func (bs *BlockSync) LastChainState() consensus.ChainState
type GetFullBlockRequest ¶
type GetFullBlockRequest struct {
Height uint64
}
type GetLatestMessagesRequest ¶
type GetLatestMessagesRequest struct { }
type GetLatestMessagesResponse ¶
type GetLatestMessagesResponse struct {
MessageData [][]byte
}
type HelloRequest ¶
type HelloRequest struct {
LastHeight uint64
}
func (*HelloRequest) ValidateBasic ¶
func (req *HelloRequest) ValidateBasic() error
type HelloResponse ¶
type HelloResponse struct {
LastHeight uint64
}
func (*HelloResponse) ValidateBasic ¶
func (req *HelloResponse) ValidateBasic() error
type PeerHandler ¶
type PeerHandler struct {
// contains filtered or unexported fields
}
type Server ¶
func NewP2PServer ¶
func (*Server) SetConsensusState ¶
func (server *Server) SetConsensusState(cs *consensus.ConsensusState)
Click to show internal directories.
Click to hide internal directories.