This commit is contained in:
Jared Wasinger 2025-04-22 16:22:19 +08:00
parent 3657810695
commit b8d64aa30a
2 changed files with 3 additions and 19 deletions

View file

@ -31,8 +31,6 @@ var (
bodyReqTimer = metrics.NewRegisteredTimer("eth/downloader/bodies/req", nil)
bodyDropMeter = metrics.NewRegisteredMeter("eth/downloader/bodies/drop", nil)
bodyTimeoutMeter = metrics.NewRegisteredMeter("eth/downloader/bodies/timeout", nil)
blockSizeGauge = metrics.NewRegisteredGauge("eth/downloader/blocks/size", nil)
pendingBodyGauge = metrics.NewRegisteredGauge("eth/downloader/bodies/pending", nil)
receiptInMeter = metrics.NewRegisteredMeter("eth/downloader/receipts/in", nil)

View file

@ -22,11 +22,6 @@ package downloader
import (
"errors"
"fmt"
"sync"
"sync/atomic"
"time"
"unsafe"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/prque"
"github.com/ethereum/go-ethereum/core/types"
@ -35,6 +30,9 @@ import (
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/params"
"sync"
"sync/atomic"
"time"
)
const (
@ -89,18 +87,6 @@ func newFetchResult(header *types.Header, snapSync bool) *fetchResult {
return item
}
func (f *fetchResult) Size() int {
receiptsSize := 0
for _, r := range f.Receipts {
receiptsSize += int(r.Size())
}
txsSize := 0
for _, t := range f.Transactions {
txsSize += int(t.Size())
}
return common.HashLength*len(f.Uncles) + int(unsafe.Sizeof(types.Withdrawal{})) + int(f.Header.Size()) + receiptsSize + txsSize
}
// body returns a representation of the fetch result as a types.Body object.
func (f *fetchResult) body() types.Body {
return types.Body{