mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-10 07:58:22 -05:00
Fix Goodbye Codes In Prysm (#11168)
* fix goodbye codes * gaz Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
@@ -38,6 +38,7 @@ go_test(
|
||||
embed = [":go_default_library"],
|
||||
deps = [
|
||||
"//config/params:go_default_library",
|
||||
"//consensus-types/primitives:go_default_library",
|
||||
"//encoding/bytesutil:go_default_library",
|
||||
"//testing/assert:go_default_library",
|
||||
"//testing/require:go_default_library",
|
||||
|
||||
@@ -9,7 +9,7 @@ type RPCGoodbyeCode = types.SSZUint64
|
||||
|
||||
const (
|
||||
// Spec defined codes.
|
||||
GoodbyeCodeClientShutdown RPCGoodbyeCode = iota
|
||||
GoodbyeCodeClientShutdown RPCGoodbyeCode = iota + 1
|
||||
GoodbyeCodeWrongNetwork
|
||||
GoodbyeCodeGenericError
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/prysmaticlabs/prysm/config/params"
|
||||
types "github.com/prysmaticlabs/prysm/consensus-types/primitives"
|
||||
"github.com/prysmaticlabs/prysm/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/testing/require"
|
||||
)
|
||||
@@ -107,6 +108,17 @@ func TestSSZBytes_HashTreeRoot(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestGoodbyeCodes(t *testing.T) {
|
||||
assert.Equal(t, types.SSZUint64(1), GoodbyeCodeClientShutdown)
|
||||
assert.Equal(t, types.SSZUint64(2), GoodbyeCodeWrongNetwork)
|
||||
assert.Equal(t, types.SSZUint64(3), GoodbyeCodeGenericError)
|
||||
assert.Equal(t, types.SSZUint64(128), GoodbyeCodeUnableToVerifyNetwork)
|
||||
assert.Equal(t, types.SSZUint64(129), GoodbyeCodeTooManyPeers)
|
||||
assert.Equal(t, types.SSZUint64(250), GoodbyeCodeBadScore)
|
||||
assert.Equal(t, types.SSZUint64(251), GoodbyeCodeBanned)
|
||||
|
||||
}
|
||||
|
||||
func hexDecodeOrDie(t *testing.T, str string) []byte {
|
||||
decoded, err := hex.DecodeString(str)
|
||||
require.NoError(t, err)
|
||||
|
||||
Reference in New Issue
Block a user