fix block validation in stage bodies

pull/4465/head
“GheisMohammadi” 1 year ago
parent cd7ccbe827
commit 772d8658e1
No known key found for this signature in database
GPG Key ID: 15073AED3829FE90
  1. 13
      api/service/stagedstreamsync/stage_bodies.go

@ -187,12 +187,6 @@ func (b *StageBodies) runBlockWorkerLoop(ctx context.Context, gbm *blockDownload
gbm.HandleRequestError(batch, err, stid) gbm.HandleRequestError(batch, err, stid)
b.configs.protocol.RemoveStream(stid) b.configs.protocol.RemoveStream(stid)
} else { } else {
if b.configs.extractReceiptHashes {
if err = b.verifyBlockAndExtractReceiptsData(blockBytes, sigBytes, s); err != nil {
gbm.HandleRequestError(batch, err, stid)
continue
}
}
if err = b.saveBlocks(ctx, gbm.tx, batch, blockBytes, sigBytes, loopID, stid); err != nil { if err = b.saveBlocks(ctx, gbm.tx, batch, blockBytes, sigBytes, loopID, stid); err != nil {
panic(ErrSaveBlocksToDbFailed) panic(ErrSaveBlocksToDbFailed)
} }
@ -231,10 +225,9 @@ func (b *StageBodies) verifyBlockAndExtractReceiptsData(batchBlockBytes [][]byte
block.SetCurrentCommitSig(sigBytes) block.SetCurrentCommitSig(sigBytes)
} }
if block.NumberU64() != i { // if block.NumberU64() != i {
return ErrInvalidBlockNumber // return ErrInvalidBlockNumber
} // }
if err := verifyBlock(b.configs.bc, block); err != nil { if err := verifyBlock(b.configs.bc, block); err != nil {
return err return err
} }

Loading…
Cancel
Save