mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-15 17:30:44 +00:00
core/types: improve comments in new EIP-2718 code (#22402)
This commit is contained in:
parent
b8974be16e
commit
349dc1bacd
3 changed files with 5 additions and 7 deletions
|
|
@ -36,6 +36,7 @@ var encodeBufferPool = sync.Pool{
|
||||||
New: func() interface{} { return new(bytes.Buffer) },
|
New: func() interface{} { return new(bytes.Buffer) },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// rlpHash encodes x and hashes the encoded bytes.
|
||||||
func rlpHash(x interface{}) (h common.Hash) {
|
func rlpHash(x interface{}) (h common.Hash) {
|
||||||
sha := hasherPool.Get().(crypto.KeccakState)
|
sha := hasherPool.Get().(crypto.KeccakState)
|
||||||
defer hasherPool.Put(sha)
|
defer hasherPool.Put(sha)
|
||||||
|
|
@ -45,8 +46,8 @@ func rlpHash(x interface{}) (h common.Hash) {
|
||||||
return h
|
return h
|
||||||
}
|
}
|
||||||
|
|
||||||
// prefixedRlpHash writes the prefix into the hasher before rlp-encoding the
|
// prefixedRlpHash writes the prefix into the hasher before rlp-encoding x.
|
||||||
// given interface. It's used for typed transactions.
|
// It's used for typed transactions.
|
||||||
func prefixedRlpHash(prefix byte, x interface{}) (h common.Hash) {
|
func prefixedRlpHash(prefix byte, x interface{}) (h common.Hash) {
|
||||||
sha := hasherPool.Get().(crypto.KeccakState)
|
sha := hasherPool.Get().(crypto.KeccakState)
|
||||||
defer hasherPool.Put(sha)
|
defer hasherPool.Put(sha)
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ var (
|
||||||
receiptStatusSuccessfulRLP = []byte{0x01}
|
receiptStatusSuccessfulRLP = []byte{0x01}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// This error is returned when a typed receipt is decoded, but the string is empty.
|
||||||
var errEmptyTypedReceipt = errors.New("empty typed receipt bytes")
|
var errEmptyTypedReceipt = errors.New("empty typed receipt bytes")
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
||||||
|
|
@ -212,11 +212,7 @@ func (s eip2930Signer) Sender(tx *Transaction) (common.Address, error) {
|
||||||
func (s eip2930Signer) SignatureValues(tx *Transaction, sig []byte) (R, S, V *big.Int, err error) {
|
func (s eip2930Signer) SignatureValues(tx *Transaction, sig []byte) (R, S, V *big.Int, err error) {
|
||||||
switch txdata := tx.inner.(type) {
|
switch txdata := tx.inner.(type) {
|
||||||
case *LegacyTx:
|
case *LegacyTx:
|
||||||
R, S, V = decodeSignature(sig)
|
return s.EIP155Signer.SignatureValues(tx, sig)
|
||||||
if s.chainId.Sign() != 0 {
|
|
||||||
V = big.NewInt(int64(sig[64] + 35))
|
|
||||||
V.Add(V, s.chainIdMul)
|
|
||||||
}
|
|
||||||
case *AccessListTx:
|
case *AccessListTx:
|
||||||
// Check that chain ID of tx matches the signer. We also accept ID zero here,
|
// Check that chain ID of tx matches the signer. We also accept ID zero here,
|
||||||
// because it indicates that the chain ID was not specified in the tx.
|
// because it indicates that the chain ID was not specified in the tx.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue