diff options
author | Mission Liao <mission.liao@dexon.org> | 2019-05-06 20:33:04 +0800 |
---|---|---|
committer | Mission Liao <mission.liao@dexon.org> | 2019-05-07 15:09:40 +0800 |
commit | 99a48ce37ebd79105d1ade2cd4cfa5ff85afe974 (patch) | |
tree | bad6cd524255c8f07f97bb11b1ff2a6b6e82deaa | |
parent | 33c54c38bde8be4a779c6c9b834c46d87dd1ca61 (diff) | |
download | dexon-99a48ce37ebd79105d1ade2cd4cfa5ff85afe974.tar.gz dexon-99a48ce37ebd79105d1ade2cd4cfa5ff85afe974.tar.zst dexon-99a48ce37ebd79105d1ade2cd4cfa5ff85afe974.zip |
Fix lint error: unnecessary conversion
-rw-r--r-- | dex/consensus/common/types.go | 2 | ||||
-rw-r--r-- | dex/consensus/core/crypto/dkg/utils.go | 2 | ||||
-rw-r--r-- | dex/consensus/core/crypto/utils.go | 2 | ||||
-rw-r--r-- | dex/consensus/core/test/block-revealer.go | 2 | ||||
-rw-r--r-- | dex/consensus/core/types/block.go | 2 | ||||
-rw-r--r-- | dex/consensus/core/types/node.go | 2 |
6 files changed, 6 insertions, 6 deletions
diff --git a/dex/consensus/common/types.go b/dex/consensus/common/types.go index 883492bf3..ac96f570d 100644 --- a/dex/consensus/common/types.go +++ b/dex/consensus/common/types.go @@ -33,7 +33,7 @@ const ( type Hash [HashLength]byte func (h Hash) String() string { - return hex.EncodeToString([]byte(h[:])) + return hex.EncodeToString(h[:]) } // Bytes return the hash as slice of bytes. diff --git a/dex/consensus/core/crypto/dkg/utils.go b/dex/consensus/core/crypto/dkg/utils.go index 9eb63fb50..f2effd451 100644 --- a/dex/consensus/core/crypto/dkg/utils.go +++ b/dex/consensus/core/crypto/dkg/utils.go @@ -43,7 +43,7 @@ func RecoverSignature(sigs []PartialSignature, signerIDs IDs) ( if len(sig.Signature) == 0 { return crypto.Signature{}, ErrEmptySignature } - if err := blsSigs[i].Deserialize([]byte(sig.Signature)); err != nil { + if err := blsSigs[i].Deserialize(sig.Signature); err != nil { return crypto.Signature{}, err } } diff --git a/dex/consensus/core/crypto/utils.go b/dex/consensus/core/crypto/utils.go index 8cc0d57b5..fc4891dcb 100644 --- a/dex/consensus/core/crypto/utils.go +++ b/dex/consensus/core/crypto/utils.go @@ -58,7 +58,7 @@ func (sig Signature) Clone() Signature { } func (sig Signature) String() string { - return hex.EncodeToString([]byte(sig.Signature[:])) + return hex.EncodeToString(sig.Signature[:]) } // RegisterSigToPub registers a sigToPub function of type. diff --git a/dex/consensus/core/test/block-revealer.go b/dex/consensus/core/test/block-revealer.go index c473acabb..5abc121ca 100644 --- a/dex/consensus/core/test/block-revealer.go +++ b/dex/consensus/core/test/block-revealer.go @@ -73,7 +73,7 @@ func NewBlockRevealerByPosition(iter db.BlockIterator, startHeight uint64) ( } blocks = append(blocks, b) } - sort.Sort(types.BlocksByPosition(blocks)) + sort.Sort(blocks) // Make sure the height of blocks are incremental with step 1. for idx, b := range blocks { if idx == 0 { diff --git a/dex/consensus/core/types/block.go b/dex/consensus/core/types/block.go index a930625be..f949acb56 100644 --- a/dex/consensus/core/types/block.go +++ b/dex/consensus/core/types/block.go @@ -259,7 +259,7 @@ func (b ByHash) Len() int { } func (b ByHash) Less(i int, j int) bool { - return bytes.Compare([]byte(b[i].Hash[:]), []byte(b[j].Hash[:])) == -1 + return bytes.Compare(b[i].Hash[:], b[j].Hash[:]) == -1 } func (b ByHash) Swap(i int, j int) { diff --git a/dex/consensus/core/types/node.go b/dex/consensus/core/types/node.go index 7e052f11b..d391c9d64 100644 --- a/dex/consensus/core/types/node.go +++ b/dex/consensus/core/types/node.go @@ -53,7 +53,7 @@ func (v NodeIDs) Len() int { } func (v NodeIDs) Less(i int, j int) bool { - return bytes.Compare([]byte(v[i].Hash[:]), []byte(v[j].Hash[:])) == -1 + return bytes.Compare(v[i].Hash[:], v[j].Hash[:]) == -1 } func (v NodeIDs) Swap(i int, j int) { |