github.com/noirx94/tendermintmp@v0.0.1/state/services.go (about)

     1  package state
     2  
     3  import (
     4  	"github.com/tendermint/tendermint/types"
     5  )
     6  
     7  //------------------------------------------------------
     8  // blockchain services types
     9  // NOTE: Interfaces used by RPC must be thread safe!
    10  //------------------------------------------------------
    11  
    12  //------------------------------------------------------
    13  // blockstore
    14  
    15  //go:generate mockery --case underscore --name BlockStore
    16  
    17  // BlockStore defines the interface used by the ConsensusState.
    18  type BlockStore interface {
    19  	Base() int64
    20  	Height() int64
    21  	Size() int64
    22  
    23  	LoadBaseMeta() *types.BlockMeta
    24  	LoadBlockMeta(height int64) *types.BlockMeta
    25  	LoadBlock(height int64) *types.Block
    26  
    27  	SaveBlock(block *types.Block, blockParts *types.PartSet, seenCommit *types.Commit)
    28  
    29  	PruneBlocks(height int64) (uint64, error)
    30  
    31  	LoadBlockByHash(hash []byte) *types.Block
    32  	LoadBlockPart(height int64, index int) *types.Part
    33  
    34  	LoadBlockCommit(height int64) *types.Commit
    35  	LoadSeenCommit(height int64) *types.Commit
    36  }
    37  
    38  //-----------------------------------------------------------------------------
    39  // evidence pool
    40  
    41  //go:generate mockery --case underscore --name EvidencePool
    42  
    43  // EvidencePool defines the EvidencePool interface used by State.
    44  type EvidencePool interface {
    45  	PendingEvidence(maxBytes int64) (ev []types.Evidence, size int64)
    46  	AddEvidence(types.Evidence) error
    47  	Update(State, types.EvidenceList)
    48  	CheckEvidence(types.EvidenceList) error
    49  }
    50  
    51  // EmptyEvidencePool is an empty implementation of EvidencePool, useful for testing. It also complies
    52  // to the consensus evidence pool interface
    53  type EmptyEvidencePool struct{}
    54  
    55  func (EmptyEvidencePool) PendingEvidence(maxBytes int64) (ev []types.Evidence, size int64) {
    56  	return nil, 0
    57  }
    58  func (EmptyEvidencePool) AddEvidence(types.Evidence) error                { return nil }
    59  func (EmptyEvidencePool) Update(State, types.EvidenceList)                {}
    60  func (EmptyEvidencePool) CheckEvidence(evList types.EvidenceList) error   { return nil }
    61  func (EmptyEvidencePool) ReportConflictingVotes(voteA, voteB *types.Vote) {}