mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
cmd/registrar, contracts/registrar: fix lints
This commit is contained in:
parent
75a2172d12
commit
7ca0916ab9
2 changed files with 3 additions and 6 deletions
|
|
@ -262,10 +262,7 @@ func registerCheckpoint(ctx *cli.Context) error {
|
||||||
}
|
}
|
||||||
sigStrs := strings.Split(ctx.GlobalString(signatureFlag.Name), ",")
|
sigStrs := strings.Split(ctx.GlobalString(signatureFlag.Name), ",")
|
||||||
for _, sig := range sigStrs {
|
for _, sig := range sigStrs {
|
||||||
trimmed := strings.TrimSpace(sig)
|
trimmed := strings.TrimPrefix(strings.TrimSpace(sig), "0x")
|
||||||
if strings.HasPrefix(trimmed, "0x") {
|
|
||||||
trimmed = trimmed[2:]
|
|
||||||
}
|
|
||||||
if len(trimmed) != 130 {
|
if len(trimmed) != 130 {
|
||||||
utils.Fatalf("Invalid signature in --signature: %s", trimmed)
|
utils.Fatalf("Invalid signature in --signature: %s", trimmed)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,7 @@ func assertSignature(addr common.Address, index uint64, hash [32]byte, r, s [32]
|
||||||
}
|
}
|
||||||
var signer common.Address
|
var signer common.Address
|
||||||
copy(signer[:], crypto.Keccak256(pubkey[1:])[12:])
|
copy(signer[:], crypto.Keccak256(pubkey[1:])[12:])
|
||||||
return bytes.Compare(signer.Bytes(), expect.Bytes()) == 0
|
return bytes.Equal(signer.Bytes(), expect.Bytes())
|
||||||
}
|
}
|
||||||
|
|
||||||
type Account struct {
|
type Account struct {
|
||||||
|
|
@ -213,7 +213,7 @@ func TestCheckpointRegister(t *testing.T) {
|
||||||
if lindex != index {
|
if lindex != index {
|
||||||
return errors.New("latest checkpoint index mismatch")
|
return errors.New("latest checkpoint index mismatch")
|
||||||
}
|
}
|
||||||
if bytes.Compare(lhash[:], hash[:]) != 0 {
|
if !bytes.Equal(lhash[:], hash[:]) {
|
||||||
return errors.New("latest checkpoint hash mismatch")
|
return errors.New("latest checkpoint hash mismatch")
|
||||||
}
|
}
|
||||||
if lheight.Cmp(height) != 0 {
|
if lheight.Cmp(height) != 0 {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue