mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
Removes unsafe package in exchange for binary.Size({} interface) to get
the size of Header interface
This commit is contained in:
parent
2d98099c25
commit
4b3fe05fe7
1 changed files with 2 additions and 2 deletions
|
|
@ -24,7 +24,6 @@ import (
|
|||
"sort"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
"unsafe"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
|
|
@ -105,7 +104,8 @@ func (h *Header) Hash() common.Hash {
|
|||
// Size returns the approximate memory used by all internal contents. It is used
|
||||
// to approximate and limit the memory consumption of various caches.
|
||||
func (h *Header) Size() common.StorageSize {
|
||||
return common.StorageSize(unsafe.Sizeof(*h)) + common.StorageSize(len(h.Extra)+(h.Difficulty.BitLen()+h.Number.BitLen()+h.Time.BitLen())/8)
|
||||
size := binary.Size(h)
|
||||
return common.StorageSize(size) + common.StorageSize(len(h.Extra)+(h.Difficulty.BitLen()+h.Number.BitLen()+h.Time.BitLen())/8)
|
||||
}
|
||||
|
||||
func rlpHash(x interface{}) (h common.Hash) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue