mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
apply comments
This commit is contained in:
parent
1638bd3d05
commit
330582e1b3
2 changed files with 7 additions and 9 deletions
|
|
@ -43,18 +43,18 @@ type withdrawalMarshaling struct {
|
|||
Amount hexutil.Uint64
|
||||
}
|
||||
|
||||
var withdrawalSize = common.StorageSize(reflect.TypeOf(Withdrawal{}).Size())
|
||||
|
||||
func (w Withdrawal) Size() common.StorageSize {
|
||||
return common.StorageSize(withdrawalSize)
|
||||
}
|
||||
|
||||
// Withdrawals implements DerivableList for withdrawals.
|
||||
type Withdrawals []*Withdrawal
|
||||
|
||||
// Len returns the length of s.
|
||||
func (s Withdrawals) Len() int { return len(s) }
|
||||
|
||||
var withdrawalSize = int(reflect.TypeOf(Withdrawal{}).Size())
|
||||
|
||||
func (s Withdrawals) Size() int {
|
||||
return withdrawalSize * len(s)
|
||||
}
|
||||
|
||||
// EncodeIndex encodes the i'th withdrawal to w. Note that this does not check for errors
|
||||
// because we assume that *Withdrawal will only ever contain valid withdrawals that were either
|
||||
// constructed by decoding or via public API in this package.
|
||||
|
|
|
|||
|
|
@ -385,9 +385,7 @@ func (q *queue) Results(block bool) []*fetchResult {
|
|||
for _, tx := range result.Transactions {
|
||||
size += common.StorageSize(tx.Size())
|
||||
}
|
||||
for _, withdrawal := range result.Withdrawals {
|
||||
size += withdrawal.Size()
|
||||
}
|
||||
size += common.StorageSize(result.Withdrawals.Size())
|
||||
q.resultSize = common.StorageSize(blockCacheSizeWeight)*size +
|
||||
(1-common.StorageSize(blockCacheSizeWeight))*q.resultSize
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue