Skip to content

Commit 9983072

Browse files
authored
1 parent bc47993 commit 9983072

4 files changed

Lines changed: 21 additions & 7 deletions

File tree

‎core/types/hashing.go‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ var encodeBufferPool = sync.Pool{
3636
New: func() interface{} { return new(bytes.Buffer) },
3737
}
3838

39+
// rlpHash encodes x and hashes the encoded bytes.
3940
func rlpHash(x interface{}) (h common.Hash) {
4041
sha := hasherPool.Get().(crypto.KeccakState)
4142
defer hasherPool.Put(sha)
@@ -45,8 +46,8 @@ func rlpHash(x interface{}) (h common.Hash) {
4546
return h
4647
}
4748

48-
// prefixedRlpHash writes the prefix into the hasher before rlp-encoding the
49-
// given interface. It's used for typed transactions.
49+
// prefixedRlpHash writes the prefix into the hasher before rlp-encoding x.
50+
// It's used for typed transactions.
5051
func prefixedRlpHash(prefix byte, x interface{}) (h common.Hash) {
5152
sha := hasherPool.Get().(crypto.KeccakState)
5253
defer hasherPool.Put(sha)

‎core/types/hashing_test.go‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
// Copyright 2021 The go-ethereum Authors
2+
// This file is part of the go-ethereum library.
3+
//
4+
// The go-ethereum library is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU Lesser General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
//
9+
// The go-ethereum library is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU Lesser General Public License for more details.
13+
//
14+
// You should have received a copy of the GNU Lesser General Public License
15+
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
16+
117
package types_test
218

319
import (

‎core/types/receipt.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ var (
3838
receiptStatusSuccessfulRLP = []byte{0x01}
3939
)
4040

41+
// This error is returned when a typed receipt is decoded, but the string is empty.
4142
var errEmptyTypedReceipt = errors.New("empty typed receipt bytes")
4243

4344
const (

‎core/types/transaction_signing.go‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,7 @@ func (s eip2930Signer) Sender(tx *Transaction) (common.Address, error) {
207207
func (s eip2930Signer) SignatureValues(tx *Transaction, sig []byte) (R, S, V *big.Int, err error) {
208208
switch txdata := tx.inner.(type) {
209209
case *LegacyTx:
210-
R, S, V = decodeSignature(sig)
211-
if s.chainId.Sign() != 0 {
212-
V = big.NewInt(int64(sig[64] + 35))
213-
V.Add(V, s.chainIdMul)
214-
}
210+
return s.EIP155Signer.SignatureValues(tx, sig)
215211
case *AccessListTx:
216212
// Check that chain ID of tx matches the signer. We also accept ID zero here,
217213
// because it indicates that the chain ID was not specified in the tx.

0 commit comments

Comments
 (0)