@@ -35,8 +35,8 @@ import (
3535)
3636
3737var (
38- secp256k1_N , _ = new (big.Int ).SetString ("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141" , 16 )
39- secp256k1_halfN = new (big.Int ).Div (secp256k1_N , big .NewInt (2 ))
38+ secp256k1N , _ = new (big.Int ).SetString ("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141" , 16 )
39+ secp256k1halfN = new (big.Int ).Div (secp256k1N , big .NewInt (2 ))
4040)
4141
4242// Keccak256 calculates and returns the Keccak256 hash of the input data.
@@ -68,7 +68,7 @@ func Keccak512(data ...[]byte) []byte {
6868 return d .Sum (nil )
6969}
7070
71- // Creates an ethereum address given the bytes and the nonce
71+ // CreateAddress creates an ethereum address given the bytes and the nonce
7272func CreateAddress (b common.Address , nonce uint64 ) common.Address {
7373 data , _ := rlp .EncodeToBytes ([]interface {}{b , nonce })
7474 return common .BytesToAddress (Keccak256 (data )[12 :])
@@ -99,7 +99,7 @@ func toECDSA(d []byte, strict bool) (*ecdsa.PrivateKey, error) {
9999 priv .D = new (big.Int ).SetBytes (d )
100100
101101 // The priv.D must < N
102- if priv .D .Cmp (secp256k1_N ) >= 0 {
102+ if priv .D .Cmp (secp256k1N ) >= 0 {
103103 return nil , fmt .Errorf ("invalid private key, >=N" )
104104 }
105105 // The priv.D must not be zero or negative.
@@ -184,11 +184,11 @@ func ValidateSignatureValues(v byte, r, s *big.Int, homestead bool) bool {
184184 }
185185 // reject upper range of s values (ECDSA malleability)
186186 // see discussion in secp256k1/libsecp256k1/include/secp256k1.h
187- if homestead && s .Cmp (secp256k1_halfN ) > 0 {
187+ if homestead && s .Cmp (secp256k1halfN ) > 0 {
188188 return false
189189 }
190190 // Frontier: allow s to be in full N range
191- return r .Cmp (secp256k1_N ) < 0 && s .Cmp (secp256k1_N ) < 0 && (v == 0 || v == 1 )
191+ return r .Cmp (secp256k1N ) < 0 && s .Cmp (secp256k1N ) < 0 && (v == 0 || v == 1 )
192192}
193193
194194func PubkeyToAddress (p ecdsa.PublicKey ) common.Address {
0 commit comments