|
|
@ -29,7 +29,7 @@ func verifyAndInsertBlocks(bc blockChain, blocks types.Blocks, blockExecution bo |
|
|
|
return len(blocks), nil |
|
|
|
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 ( |
|
|
|
var ( |
|
|
|
sigBytes bls.SerializedSignature |
|
|
|
sigBytes bls.SerializedSignature |
|
|
|
bitmap []byte |
|
|
|
bitmap []byte |
|
|
@ -61,7 +61,18 @@ func verifyAndInsertBlock(bc blockChain, block *types.Block, blockExecution bool |
|
|
|
case err != nil: |
|
|
|
case err != nil: |
|
|
|
return errors.Wrap(err, "[InsertChain]") |
|
|
|
return errors.Wrap(err, "[InsertChain]") |
|
|
|
default: |
|
|
|
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 |
|
|
|
return nil |
|
|
|
} |
|
|
|
} |
|
|
|