Switch to evidence type enum

This commit is contained in:
Christopher Goes 2018-05-31 01:47:24 +02:00
parent 5c4c486e7b
commit 3d37d51795
No known key found for this signature in database
GPG Key ID: E828D98232D328D3
3 changed files with 6 additions and 8 deletions

5
Gopkg.lock generated
View File

@ -267,8 +267,7 @@
"server",
"types"
]
revision = "f9dce537281ffba5d1e047e6729429f7e5fb90c9"
version = "v0.11.0-rc0"
revision = "c67bb414c7ee617f18d81a50f8a837318bb6d7dc"
[[projects]]
branch = "master"
@ -461,6 +460,6 @@
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "04b888e63be8b6999da76f98c44c12a21920b12186378957d6b874270f300aaf"
inputs-digest = "8f9c58893f04daef93d91512e658560cf076a766fc100c8bc4f718d7abf1ea9c"
solver-name = "gps-cdcl"
solver-version = 1

View File

@ -52,9 +52,9 @@
name = "github.com/stretchr/testify"
version = "~1.2.1"
[[constraint]]
[[override]]
name = "github.com/tendermint/abci"
version = "0.11.0-rc0"
revision = "c67bb414c7ee617f18d81a50f8a837318bb6d7dc"
[[constraint]]
name = "github.com/tendermint/go-crypto"

View File

@ -1,7 +1,6 @@
package slashing
import (
"bytes"
"encoding/binary"
"fmt"
@ -21,8 +20,8 @@ func NewBeginBlocker(sk Keeper) sdk.BeginBlocker {
for _, evidence := range req.ByzantineValidators {
var pk crypto.PubKey
sk.cdc.MustUnmarshalBinary(evidence.PubKey, &pk)
switch {
case bytes.Compare(evidence.Type, []byte("doubleSign")) == 0:
switch evidence.Type {
case abci.EvidenceType_DOUBLE_SIGN:
sk.handleDoubleSign(ctx, evidence.Height, evidence.Time, pk)
default:
ctx.Logger().With("module", "x/slashing").Error(fmt.Sprintf("Ignored unknown evidence type: %s", string(evidence.Type)))