forked from cerc-io/plugeth
core: fix WriteBlockAndSetHead documentation (#24818)
This commit is contained in:
parent
992151fa6d
commit
11b56ace2a
@ -1266,7 +1266,8 @@ func (bc *BlockChain) writeBlockWithState(block *types.Block, receipts []*types.
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// WriteBlockWithState writes the block and all associated state to the database.
|
// WriteBlockAndSetHead writes the given block and all associated state to the database,
|
||||||
|
// and applies the block as the new chain head.
|
||||||
func (bc *BlockChain) WriteBlockAndSetHead(block *types.Block, receipts []*types.Receipt, logs []*types.Log, state *state.StateDB, emitHeadEvent bool) (status WriteStatus, err error) {
|
func (bc *BlockChain) WriteBlockAndSetHead(block *types.Block, receipts []*types.Receipt, logs []*types.Log, state *state.StateDB, emitHeadEvent bool) (status WriteStatus, err error) {
|
||||||
if !bc.chainmu.TryLock() {
|
if !bc.chainmu.TryLock() {
|
||||||
return NonStatTy, errChainStopped
|
return NonStatTy, errChainStopped
|
||||||
@ -1276,9 +1277,8 @@ func (bc *BlockChain) WriteBlockAndSetHead(block *types.Block, receipts []*types
|
|||||||
return bc.writeBlockAndSetHead(block, receipts, logs, state, emitHeadEvent)
|
return bc.writeBlockAndSetHead(block, receipts, logs, state, emitHeadEvent)
|
||||||
}
|
}
|
||||||
|
|
||||||
// writeBlockAndSetHead writes the block and all associated state to the database,
|
// writeBlockAndSetHead is the internal implementation of WriteBlockAndSetHead.
|
||||||
// and also it applies the given block as the new chain head. This function expects
|
// This function expects the chain mutex to be held.
|
||||||
// the chain mutex to be held.
|
|
||||||
func (bc *BlockChain) writeBlockAndSetHead(block *types.Block, receipts []*types.Receipt, logs []*types.Log, state *state.StateDB, emitHeadEvent bool) (status WriteStatus, err error) {
|
func (bc *BlockChain) writeBlockAndSetHead(block *types.Block, receipts []*types.Receipt, logs []*types.Log, state *state.StateDB, emitHeadEvent bool) (status WriteStatus, err error) {
|
||||||
if err := bc.writeBlockWithState(block, receipts, logs, state); err != nil {
|
if err := bc.writeBlockWithState(block, receipts, logs, state); err != nil {
|
||||||
return NonStatTy, err
|
return NonStatTy, err
|
||||||
|
Loading…
Reference in New Issue
Block a user