github.com/linapex/ethereum-go-chinese@v0.0.0-20190316121929-f8b7a73c3fa1/core/types.go (about)

     1  
     2  //<developer>
     3  //    <name>linapex 曹一峰</name>
     4  //    <email>linapex@163.com</email>
     5  //    <wx>superexc</wx>
     6  //    <qqgroup>128148617</qqgroup>
     7  //    <url>https://jsq.ink</url>
     8  //    <role>pku engineer</role>
     9  //    <date>2019-03-16 19:16:35</date>
    10  //</624450081759694848>
    11  
    12  
    13  package core
    14  
    15  import (
    16  	"github.com/ethereum/go-ethereum/core/state"
    17  	"github.com/ethereum/go-ethereum/core/types"
    18  	"github.com/ethereum/go-ethereum/core/vm"
    19  )
    20  
    21  //validator是定义块验证标准的接口。它
    22  //只负责验证块内容,因为头验证是
    23  //由特定的共识引擎完成。
    24  //
    25  type Validator interface {
    26  //validateBody验证给定块的内容。
    27  	ValidateBody(block *types.Block) error
    28  
    29  //validateState验证给定的statedb,以及可选的收据和
    30  //使用的气体。
    31  	ValidateState(block, parent *types.Block, state *state.StateDB, receipts types.Receipts, usedGas uint64) error
    32  }
    33  
    34  //处理器是使用给定初始状态处理块的接口。
    35  //
    36  //process接受要处理的块和statedb,在该块上
    37  //初始状态是基于的。它应该返回生成的收据,金额
    38  //过程中使用的气体,如果有任何内部规则,则返回错误
    39  //失败。
    40  type Processor interface {
    41  	Process(block *types.Block, statedb *state.StateDB, cfg vm.Config) (types.Receipts, []*types.Log, uint64, error)
    42  }
    43