bor: fix for TestMiningBenchmark (#9182)

integration test TestMiningBenchmark is failing the CI on devel - this
PR aims to fix it
This commit is contained in:
milen 2024-01-09 15:41:00 +00:00 committed by GitHub
parent fec0c9eef5
commit af913fdeeb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -780,7 +780,7 @@ func New(ctx context.Context, stack *node.Node, config *ethconfig.Config, logger
}
}()
if err := backend.StartMining(context.Background(), backend.chainDB, mining, backend.config.Miner, backend.gasPrice, backend.sentriesClient.Hd.QuitPoWMining, tmpdir, logger); err != nil {
if err := backend.StartMining(context.Background(), backend.chainDB, mining, backend.config.Miner, backend.sentriesClient.Hd.QuitPoWMining, tmpdir, logger); err != nil {
return nil, err
}
@ -1010,8 +1010,7 @@ func (s *Ethereum) shouldPreserve(block *types.Block) bool { //nolint
// StartMining starts the miner with the given number of CPU threads. If mining
// is already running, this method adjust the number of threads allowed to use
// and updates the minimum price required by the transaction pool.
func (s *Ethereum) StartMining(ctx context.Context, db kv.RwDB, mining *stagedsync.Sync, cfg params.MiningConfig, gasPrice *uint256.Int, quitCh chan struct{}, tmpDir string, logger log.Logger) error {
func (s *Ethereum) StartMining(ctx context.Context, db kv.RwDB, mining *stagedsync.Sync, cfg params.MiningConfig, quitCh chan struct{}, tmpDir string, logger log.Logger) error {
var borcfg *bor.Bor
if b, ok := s.engine.(*bor.Bor); ok {
borcfg = b
@ -1047,10 +1046,18 @@ func (s *Ethereum) StartMining(ctx context.Context, db kv.RwDB, mining *stagedsy
return crypto.Sign(crypto.Keccak256(message), cfg.SigKey)
})
err := stagedsync.FetchSpanZeroForMiningIfNeeded(ctx, s.chainDB, s.blockReader, borcfg.HeimdallClient, logger)
if !s.config.WithoutHeimdall {
err := stagedsync.FetchSpanZeroForMiningIfNeeded(
ctx,
s.chainDB,
s.blockReader,
borcfg.HeimdallClient,
logger,
)
if err != nil {
return err
}
}
} else {
// for the bor dev network without heimdall we need the authorizer to be set otherwise there is no
// validator defined in the bor validator set and non mining nodes will reject all blocks