mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 06:06:44 +00:00
disable peer drop, fixed td check
This commit is contained in:
parent
12d25262e9
commit
ba39d7bab7
2 changed files with 12 additions and 2 deletions
|
|
@ -122,7 +122,6 @@ func New(ctx *node.ServiceContext, config *eth.Config) (*LightNodeService, error
|
|||
if eth.protocolManager, err = NewProtocolManager(eth.chainConfig, config.LightMode, config.NetworkId, eth.eventMux, eth.pow, eth.blockchain, nil, chainDb, odr, relay); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
odr.removePeer = eth.protocolManager.removePeer
|
||||
|
||||
eth.ApiBackend = &LesApiBackend{eth, nil}
|
||||
eth.ApiBackend.gpo = gasprice.NewLightPriceOracle(eth.ApiBackend)
|
||||
|
|
|
|||
|
|
@ -51,6 +51,8 @@ const (
|
|||
MaxReceiptFetch = 128 // Amount of transaction receipts to allow fetching per request
|
||||
MaxCodeFetch = 64 // Amount of contract codes to allow fetching per request
|
||||
MaxProofsFetch = 64 // Amount of merkle proofs to be fetched per retrieval request
|
||||
|
||||
disableClientRemovePeer = true
|
||||
)
|
||||
|
||||
// errIncompatibleConfig is returned if the requested protocols and configs are
|
||||
|
|
@ -170,14 +172,23 @@ func NewProtocolManager(chainConfig *core.ChainConfig, lightSync bool, networkId
|
|||
return nil, errIncompatibleConfig
|
||||
}
|
||||
|
||||
removePeer := manager.removePeer
|
||||
if disableClientRemovePeer {
|
||||
removePeer = func(id string) {}
|
||||
}
|
||||
|
||||
if lightSync {
|
||||
glog.V(logger.Debug).Infof("LES: create downloader")
|
||||
manager.downloader = downloader.New(downloader.LightSync, chainDb, manager.eventMux, blockchain.HasHeader, nil, blockchain.GetHeaderByHash,
|
||||
nil, blockchain.CurrentHeader, nil, nil, nil, blockchain.GetTdByHash,
|
||||
blockchain.InsertHeaderChain, nil, nil, blockchain.Rollback, func(id string) {}) // manager.removePeer)
|
||||
blockchain.InsertHeaderChain, nil, nil, blockchain.Rollback, removePeer)
|
||||
manager.fetcher = newLightFetcher(manager)
|
||||
}
|
||||
|
||||
if odr != nil {
|
||||
odr.removePeer = removePeer
|
||||
}
|
||||
|
||||
/*validator := func(block *types.Block, parent *types.Block) error {
|
||||
return core.ValidateHeader(pow, block.Header(), parent.Header(), true, false)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue