mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
eth/downloader, core/types: adding withdrawal size to downloader queue
This commit is contained in:
parent
b37ac5c102
commit
f01340f205
2 changed files with 8 additions and 0 deletions
|
|
@ -18,6 +18,7 @@ package types
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"unsafe"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
|
|
@ -42,6 +43,10 @@ type withdrawalMarshaling struct {
|
|||
Amount hexutil.Uint64
|
||||
}
|
||||
|
||||
func (w Withdrawal) Size() common.StorageSize {
|
||||
return common.StorageSize(unsafe.Sizeof(w))
|
||||
}
|
||||
|
||||
// Withdrawals implements DerivableList for withdrawals.
|
||||
type Withdrawals []*Withdrawal
|
||||
|
||||
|
|
|
|||
|
|
@ -385,6 +385,9 @@ 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()
|
||||
}
|
||||
q.resultSize = common.StorageSize(blockCacheSizeWeight)*size +
|
||||
(1-common.StorageSize(blockCacheSizeWeight))*q.resultSize
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue