-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
128 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package behavior | ||
|
||
import ( | ||
"github.com/line/ostracon/p2p" | ||
) | ||
|
||
// PeerBehavior is a struct describing a behavior a peer performed. | ||
// `peerID` identifies the peer and reason characterizes the specific | ||
// behavior performed by the peer. | ||
type PeerBehavior struct { | ||
peerID p2p.ID | ||
reason interface{} | ||
} | ||
|
||
type badMessage struct { | ||
explanation string | ||
} | ||
|
||
// BadMessage returns a badMessage PeerBehavior. | ||
func BadMessage(peerID p2p.ID, explanation string) PeerBehavior { | ||
return PeerBehavior{peerID: peerID, reason: badMessage{explanation}} | ||
} | ||
|
||
type messageOutOfOrder struct { | ||
explanation string | ||
} | ||
|
||
// MessageOutOfOrder returns a messagOutOfOrder PeerBehavior. | ||
func MessageOutOfOrder(peerID p2p.ID, explanation string) PeerBehavior { | ||
return PeerBehavior{peerID: peerID, reason: messageOutOfOrder{explanation}} | ||
} | ||
|
||
type consensusVote struct { | ||
explanation string | ||
} | ||
|
||
// ConsensusVote returns a consensusVote PeerBehavior. | ||
func ConsensusVote(peerID p2p.ID, explanation string) PeerBehavior { | ||
return PeerBehavior{peerID: peerID, reason: consensusVote{explanation}} | ||
} | ||
|
||
type blockPart struct { | ||
explanation string | ||
} | ||
|
||
// BlockPart returns blockPart PeerBehavior. | ||
func BlockPart(peerID p2p.ID, explanation string) PeerBehavior { | ||
return PeerBehavior{peerID: peerID, reason: blockPart{explanation}} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.