mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-03 19:53:58 +00:00
* abci: PrepareProposal-VoteExtension integration [2nd try] (#7821) * PrepareProposal-VoteExtension integration (#6915) * make proto-gen * Fix protobuf crash in e2e nightly tests * Update types/vote.go Co-authored-by: M. J. Fromberger <fromberger@interchain.io> * Addressed @creachadair's comments Co-authored-by: mconcat <monoidconcat@gmail.com> Co-authored-by: M. J. Fromberger <fromberger@interchain.io> * Proto changes * make proto-gen * Fixed UTs * bump * lint * lint2 * lint3 * lint4 * lint5 * lint6 * no_lint Co-authored-by: mconcat <monoidconcat@gmail.com> Co-authored-by: M. J. Fromberger <fromberger@interchain.io>
50 lines
1.3 KiB
Go
50 lines
1.3 KiB
Go
package behaviour //nolint:misspell
|
|
|
|
import (
|
|
"github.com/tendermint/tendermint/p2p"
|
|
)
|
|
|
|
// PeerBehaviour is a struct describing a behavior a peer performed.
|
|
// `peerID` identifies the peer and reason characterizes the specific
|
|
// behavior performed by the peer.
|
|
type PeerBehaviour struct {
|
|
peerID p2p.ID
|
|
reason interface{}
|
|
}
|
|
|
|
type badMessage struct {
|
|
explanation string
|
|
}
|
|
|
|
// BadMessage returns a badMessage PeerBehaviour.
|
|
func BadMessage(peerID p2p.ID, explanation string) PeerBehaviour {
|
|
return PeerBehaviour{peerID: peerID, reason: badMessage{explanation}}
|
|
}
|
|
|
|
type messageOutOfOrder struct {
|
|
explanation string
|
|
}
|
|
|
|
// MessageOutOfOrder returns a messagOutOfOrder PeerBehaviour.
|
|
func MessageOutOfOrder(peerID p2p.ID, explanation string) PeerBehaviour {
|
|
return PeerBehaviour{peerID: peerID, reason: messageOutOfOrder{explanation}}
|
|
}
|
|
|
|
type consensusVote struct {
|
|
explanation string
|
|
}
|
|
|
|
// ConsensusVote returns a consensusVote PeerBehaviour.
|
|
func ConsensusVote(peerID p2p.ID, explanation string) PeerBehaviour {
|
|
return PeerBehaviour{peerID: peerID, reason: consensusVote{explanation}}
|
|
}
|
|
|
|
type blockPart struct {
|
|
explanation string
|
|
}
|
|
|
|
// BlockPart returns blockPart PeerBehaviour.
|
|
func BlockPart(peerID p2p.ID, explanation string) PeerBehaviour {
|
|
return PeerBehaviour{peerID: peerID, reason: blockPart{explanation}}
|
|
}
|