mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-20 23:09:27 +00:00
core/types: revert encodeSize changes generated by claude
This commit is contained in:
parent
35781edb8f
commit
4cd7092ccd
1 changed files with 6 additions and 10 deletions
|
|
@ -28,6 +28,7 @@ import (
|
|||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
"github.com/ethereum/go-ethereum/params"
|
||||
"github.com/ethereum/go-ethereum/rlp"
|
||||
"github.com/holiman/uint256"
|
||||
|
|
@ -104,18 +105,13 @@ func (e *BlockAccessList) Hash() common.Hash {
|
|||
return crypto.Keccak256Hash(enc.Bytes())
|
||||
}
|
||||
|
||||
// EncodedSize returns the size of the RLP-encoded block access list. It is
|
||||
// used by the downloader to estimate cache footprint of fetched results.
|
||||
// Returns 0 for a nil receiver to keep size accounting code branch-free.
|
||||
func (e *BlockAccessList) EncodedSize() int {
|
||||
if e == nil {
|
||||
return 0
|
||||
b, err := rlp.EncodeToBytes(e)
|
||||
if err != nil {
|
||||
// TODO: proper to crit here?
|
||||
log.Crit("failed to rlp encode access list", "err", err)
|
||||
}
|
||||
var enc bytes.Buffer
|
||||
if err := e.EncodeRLP(&enc); err != nil {
|
||||
return 0
|
||||
}
|
||||
return enc.Len()
|
||||
return len(b)
|
||||
}
|
||||
|
||||
// encodingBalanceChange is the encoding format of BalanceChange.
|
||||
|
|
|
|||
Loading…
Reference in a new issue