mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
core, eth: drop unused methods and types
This commit is contained in:
parent
05c256f9e9
commit
a0e307d423
4 changed files with 0 additions and 46 deletions
|
|
@ -179,8 +179,3 @@ func (it *insertIterator) first() *types.Block {
|
|||
func (it *insertIterator) remaining() int {
|
||||
return len(it.chain) - it.index
|
||||
}
|
||||
|
||||
// processed returns the number of processed blocks.
|
||||
func (it *insertIterator) processed() int {
|
||||
return it.index + 1
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ package eth
|
|||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"math/big"
|
||||
"sync"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
|
@ -225,24 +224,6 @@ func (ps *peerSet) snapLen() int {
|
|||
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.
|
||||
func (ps *peerSet) close() {
|
||||
ps.lock.Lock()
|
||||
|
|
|
|||
|
|
@ -17,8 +17,6 @@
|
|||
package eth
|
||||
|
||||
import (
|
||||
"math/big"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
)
|
||||
|
|
@ -29,13 +27,6 @@ const (
|
|||
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
|
||||
// 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.
|
||||
|
|
|
|||
|
|
@ -189,19 +189,6 @@ type NewBlockPacket struct {
|
|||
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.
|
||||
type GetBlockBodiesRequest []common.Hash
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue