core, eth: drop unused methods and types

This commit is contained in:
Péter Szilágyi 2024-03-05 15:27:22 +02:00
parent 05c256f9e9
commit a0e307d423
4 changed files with 0 additions and 46 deletions

View file

@ -179,8 +179,3 @@ func (it *insertIterator) first() *types.Block {
func (it *insertIterator) remaining() int { func (it *insertIterator) remaining() int {
return len(it.chain) - it.index return len(it.chain) - it.index
} }
// processed returns the number of processed blocks.
func (it *insertIterator) processed() int {
return it.index + 1
}

View file

@ -19,7 +19,6 @@ package eth
import ( import (
"errors" "errors"
"fmt" "fmt"
"math/big"
"sync" "sync"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
@ -225,24 +224,6 @@ func (ps *peerSet) snapLen() int {
return ps.snapPeers return ps.snapPeers
} }
// peerWithHighestTD retrieves the known peer with the currently highest total
// difficulty, but below the given PoS switchover threshold.
func (ps *peerSet) peerWithHighestTD() *eth.Peer {
ps.lock.RLock()
defer ps.lock.RUnlock()
var (
bestPeer *eth.Peer
bestTd *big.Int
)
for _, p := range ps.peers {
if _, td := p.Head(); bestPeer == nil || td.Cmp(bestTd) > 0 {
bestPeer, bestTd = p.Peer, td
}
}
return bestPeer
}
// close disconnects all peers. // close disconnects all peers.
func (ps *peerSet) close() { func (ps *peerSet) close() {
ps.lock.Lock() ps.lock.Lock()

View file

@ -17,8 +17,6 @@
package eth package eth
import ( import (
"math/big"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
) )
@ -29,13 +27,6 @@ const (
maxTxPacketSize = 100 * 1024 maxTxPacketSize = 100 * 1024
) )
// blockPropagation is a block propagation event, waiting for its turn in the
// broadcast queue.
type blockPropagation struct {
block *types.Block
td *big.Int
}
// broadcastTransactions is a write loop that schedules transaction broadcasts // broadcastTransactions is a write loop that schedules transaction broadcasts
// to the remote peer. The goal is to have an async writer that does not lock up // to the remote peer. The goal is to have an async writer that does not lock up
// node internals and at the same time rate limits queued data. // node internals and at the same time rate limits queued data.

View file

@ -189,19 +189,6 @@ type NewBlockPacket struct {
TD *big.Int TD *big.Int
} }
// sanityCheck verifies that the values are reasonable, as a DoS protection
func (request *NewBlockPacket) sanityCheck() error {
if err := request.Block.SanityCheck(); err != nil {
return err
}
//TD at mainnet block #7753254 is 76 bits. If it becomes 100 million times
// larger, it will still fit within 100 bits
if tdlen := request.TD.BitLen(); tdlen > 100 {
return fmt.Errorf("too large block TD: bitlen %d", tdlen)
}
return nil
}
// GetBlockBodiesRequest represents a block body query. // GetBlockBodiesRequest represents a block body query.
type GetBlockBodiesRequest []common.Hash type GetBlockBodiesRequest []common.Hash