github.com/pokt-network/tendermint@v0.32.11-0.20230426215212-59310158d3e9/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  // BlockStore defines the interface used by the ConsensusState.
    16  type BlockStore interface {
    17  	Base() int64
    18  	Height() int64
    19  	Size() int64
    20  
    21  	LoadBlockMeta(height int64) *types.BlockMeta
    22  	LoadBlock(height int64) *types.Block
    23  
    24  	SaveBlock(block *types.Block, blockParts *types.PartSet, seenCommit *types.Commit)
    25  
    26  	PruneBlocks(height int64) (uint64, error)
    27  
    28  	LoadBlockByHash(hash []byte) *types.Block
    29  	LoadBlockPart(height int64, index int) *types.Part
    30  
    31  	LoadBlockCommit(height int64) *types.Commit
    32  	LoadSeenCommit(height int64) *types.Commit
    33  }
    34  
    35  //-----------------------------------------------------------------------------
    36  // evidence pool
    37  
    38  // EvidencePool defines the EvidencePool interface used by the ConsensusState.
    39  // Get/Set/Commit
    40  type EvidencePool interface {
    41  	PendingEvidence(int64) []types.Evidence
    42  	AddEvidence(types.Evidence) error
    43  	Update(*types.Block, State)
    44  	// IsCommitted indicates if this evidence was already marked committed in another block.
    45  	IsCommitted(types.Evidence) bool
    46  	IsPending(evidence types.Evidence) bool
    47  	RollbackEvidence(height int64, latestHeight int64)
    48  }
    49  
    50  // MockEvidencePool is an empty implementation of EvidencePool, useful for testing.
    51  type MockEvidencePool struct{}
    52  
    53  func (m MockEvidencePool) RollbackEvidence(height int64, latestHeight int64) {
    54  	panic("implement me")
    55  }
    56  
    57  func (m MockEvidencePool) PendingEvidence(int64) []types.Evidence { return nil }
    58  func (m MockEvidencePool) AddEvidence(types.Evidence) error       { return nil }
    59  func (m MockEvidencePool) Update(*types.Block, State)             {}
    60  func (m MockEvidencePool) IsCommitted(types.Evidence) bool        { return false }
    61  func (m MockEvidencePool) IsPending(types.Evidence) bool          { return false }