Remove unsafe

This commit is contained in:
psogv0308 2024-08-08 01:13:22 +09:00
parent f01340f205
commit 1638bd3d05

View file

@ -18,7 +18,7 @@ package types
import ( import (
"bytes" "bytes"
"unsafe" "reflect"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/common/hexutil"
@ -43,8 +43,10 @@ type withdrawalMarshaling struct {
Amount hexutil.Uint64 Amount hexutil.Uint64
} }
var withdrawalSize = common.StorageSize(reflect.TypeOf(Withdrawal{}).Size())
func (w Withdrawal) Size() common.StorageSize { func (w Withdrawal) Size() common.StorageSize {
return common.StorageSize(unsafe.Sizeof(w)) return common.StorageSize(withdrawalSize)
} }
// Withdrawals implements DerivableList for withdrawals. // Withdrawals implements DerivableList for withdrawals.