diff --git a/api/service/stagedstreamsync/sig_verify.go b/api/service/stagedstreamsync/sig_verify.go index dc0b4cf4c..bc204fb1a 100644 --- a/api/service/stagedstreamsync/sig_verify.go +++ b/api/service/stagedstreamsync/sig_verify.go @@ -29,7 +29,7 @@ func verifyAndInsertBlocks(bc blockChain, blocks types.Blocks, blockExecution bo return len(blocks), nil } -func verifyAndInsertBlock(bc blockChain, block *types.Block, blockExecution bool, nextBlocks ...*types.Block) error { +func verifyBlock(bc blockChain, block *types.Block, nextBlocks ...*types.Block) error { var ( sigBytes bls.SerializedSignature bitmap []byte @@ -61,7 +61,18 @@ func verifyAndInsertBlock(bc blockChain, block *types.Block, blockExecution bool case err != nil: return errors.Wrap(err, "[InsertChain]") default: + } + return nil +} +func verifyAndInsertBlock(bc blockChain, block *types.Block, blockExecution bool, nextBlocks ...*types.Block) error { + //verify block + if err := verifyBlock(bc, block, nextBlocks...); err != nil { + return err + } + // insert block + if _, err := bc.InsertChain(types.Blocks{block}, false, blockExecution); err != nil { + return errors.Wrap(err, "[InsertChain]") } return nil }