github.com/sberex/go-sberex@v1.8.2-0.20181113200658-ed96ac38f7d7/core/types.go (about)

     1  // This file is part of the go-sberex library. The go-sberex library is 
     2  // free software: you can redistribute it and/or modify it under the terms 
     3  // of the GNU Lesser General Public License as published by the Free 
     4  // Software Foundation, either version 3 of the License, or (at your option)
     5  // any later version.
     6  //
     7  // The go-sberex library is distributed in the hope that it will be useful, 
     8  // but WITHOUT ANY WARRANTY; without even the implied warranty of
     9  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 
    10  // General Public License <http://www.gnu.org/licenses/> for more details.
    11  
    12  package core
    13  
    14  import (
    15  	"github.com/Sberex/go-sberex/core/state"
    16  	"github.com/Sberex/go-sberex/core/types"
    17  	"github.com/Sberex/go-sberex/core/vm"
    18  )
    19  
    20  // Validator is an interface which defines the standard for block validation. It
    21  // is only responsible for validating block contents, as the header validation is
    22  // done by the specific consensus engines.
    23  //
    24  type Validator interface {
    25  	// ValidateBody validates the given block's content.
    26  	ValidateBody(block *types.Block) error
    27  
    28  	// ValidateState validates the given statedb and optionally the receipts and
    29  	// gas used.
    30  	ValidateState(block, parent *types.Block, state *state.StateDB, receipts types.Receipts, usedGas uint64) error
    31  }
    32  
    33  // Processor is an interface for processing blocks using a given initial state.
    34  //
    35  // Process takes the block to be processed and the statedb upon which the
    36  // initial state is based. It should return the receipts generated, amount
    37  // of gas used in the process and return an error if any of the internal rules
    38  // failed.
    39  type Processor interface {
    40  	Process(block *types.Block, statedb *state.StateDB, cfg vm.Config) (types.Receipts, []*types.Log, uint64, error)
    41  }