Add lighthouse p2p Good Bye codes (#7601)

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
Preston Van Loon 2020-10-21 19:35:10 -05:00 committed by GitHub
parent 70d923cf85
commit b4c1c1db9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,15 +15,28 @@ import (
) )
const ( const (
// Spec defined codes
codeClientShutdown types.SSZUint64 = iota codeClientShutdown types.SSZUint64 = iota
codeWrongNetwork codeWrongNetwork
codeGenericError codeGenericError
// Teku specific codes
codeUnableToVerifyNetwork = types.SSZUint64(128)
// Lighthouse specific codes
codeTooManyPeers = types.SSZUint64(129)
codeBadScore = types.SSZUint64(250)
codeBanned = types.SSZUint64(251)
) )
var goodByes = map[types.SSZUint64]string{ var goodByes = map[types.SSZUint64]string{
codeClientShutdown: "client shutdown", codeClientShutdown: "client shutdown",
codeWrongNetwork: "irrelevant network", codeWrongNetwork: "irrelevant network",
codeGenericError: "fault/error", codeGenericError: "fault/error",
codeUnableToVerifyNetwork: "unable to verify network",
codeTooManyPeers: "client has too many peers",
codeBadScore: "peer score too low",
codeBanned: "client banned this node",
} }
// Add a short delay to allow the stream to flush before resetting it. // Add a short delay to allow the stream to flush before resetting it.