remove extra blockExecutions

pull/4465/head
“GheisMohammadi” 1 year ago
parent ebd689f1a0
commit 36d2abd0a4
No known key found for this signature in database
GPG Key ID: 15073AED3829FE90
  1. 6
      hmy/downloader/downloader.go
  2. 2
      hmy/downloader/longrange.go
  3. 2
      hmy/downloader/shortrange.go

@ -280,16 +280,16 @@ func (e *sigVerifyErr) Error() string {
return fmt.Sprintf("[VerifyHeaderSignature] %v", e.err.Error()) return fmt.Sprintf("[VerifyHeaderSignature] %v", e.err.Error())
} }
func verifyAndInsertBlocks(bc blockChain, blockExecution bool, blocks types.Blocks) (int, error) { func verifyAndInsertBlocks(bc blockChain, blocks types.Blocks) (int, error) {
for i, block := range blocks { for i, block := range blocks {
if err := verifyAndInsertBlock(bc, block, blockExecution, blocks[i+1:]...); err != nil { if err := verifyAndInsertBlock(bc, block, blocks[i+1:]...); err != nil {
return i, err return i, err
} }
} }
return len(blocks), nil return len(blocks), nil
} }
func verifyAndInsertBlock(bc blockChain, block *types.Block, blockExecution bool, nextBlocks ...*types.Block) error { func verifyAndInsertBlock(bc blockChain, block *types.Block, nextBlocks ...*types.Block) error {
var ( var (
sigBytes bls.SerializedSignature sigBytes bls.SerializedSignature
bitmap []byte bitmap []byte

@ -210,7 +210,7 @@ func (lsi *lrSyncIter) processBlocks(results []*blockResult, targetBN uint64) {
blocks := blockResultsToBlocks(results) blocks := blockResultsToBlocks(results)
for i, block := range blocks { for i, block := range blocks {
if err := verifyAndInsertBlock(lsi.bc, block, true); err != nil { if err := verifyAndInsertBlock(lsi.bc, block); err != nil {
lsi.logger.Warn().Err(err).Uint64("target block", targetBN). lsi.logger.Warn().Err(err).Uint64("target block", targetBN).
Uint64("block number", block.NumberU64()). Uint64("block number", block.NumberU64()).
Msg("insert blocks failed in long range") Msg("insert blocks failed in long range")

@ -74,7 +74,7 @@ func (d *Downloader) doShortRangeSync() (int, error) {
} }
d.logger.Info().Int("num blocks", len(blocks)).Msg("getBlockByHashes result") d.logger.Info().Int("num blocks", len(blocks)).Msg("getBlockByHashes result")
n, err := verifyAndInsertBlocks(d.bc, true, blocks) n, err := verifyAndInsertBlocks(d.bc, blocks)
numBlocksInsertedShortRangeHistogramVec.With(d.promLabels()).Observe(float64(n)) numBlocksInsertedShortRangeHistogramVec.With(d.promLabels()).Observe(float64(n))
if err != nil { if err != nil {
d.logger.Warn().Err(err).Int("blocks inserted", n).Msg("Insert block failed") d.logger.Warn().Err(err).Int("blocks inserted", n).Msg("Insert block failed")

Loading…
Cancel
Save