fix wrong order of constructor ()

This commit is contained in:
Alex Sharov 2021-09-10 10:06:23 +07:00 committed by GitHub
parent 98dea892c2
commit 71ec0938b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -356,23 +356,6 @@ func New(stack *node.Node, config *ethconfig.Config, logger log.Logger) (*Ethere
}
config.BodyDownloadTimeoutSeconds = 30
emptyBadHash := config.BadBlockHash == common.Hash{}
if !emptyBadHash {
var badBlockHeader *types.Header
if err = chainKv.View(context.Background(), func(tx kv.Tx) error {
header, hErr := rawdb.ReadHeaderByHash(tx, config.BadBlockHash)
badBlockHeader = header
return hErr
}); err != nil {
return nil, err
}
if badBlockHeader != nil {
unwindPoint := badBlockHeader.Number.Uint64() - 1
backend.stagedSync.UnwindTo(unwindPoint, config.BadBlockHash)
}
}
var txPoolRPC txpool_proto.TxpoolServer
var miningRPC txpool_proto.MiningServer
if config.TxPool.V2 {
@ -529,6 +512,23 @@ func New(stack *node.Node, config *ethconfig.Config, logger log.Logger) (*Ethere
return nil, err
}
emptyBadHash := config.BadBlockHash == common.Hash{}
if !emptyBadHash {
var badBlockHeader *types.Header
if err = chainKv.View(context.Background(), func(tx kv.Tx) error {
header, hErr := rawdb.ReadHeaderByHash(tx, config.BadBlockHash)
badBlockHeader = header
return hErr
}); err != nil {
return nil, err
}
if badBlockHeader != nil {
unwindPoint := badBlockHeader.Number.Uint64() - 1
backend.stagedSync.UnwindTo(unwindPoint, config.BadBlockHash)
}
}
//eth.APIBackend = &EthAPIBackend{stack.Config().ExtRPCEnabled(), stack.Config().AllowUnprotectedTxs, eth, nil}
gpoParams := config.GPO
if gpoParams.Default == nil {