forked from tendermint/tendermint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
services.go
52 lines (41 loc) · 1.75 KB
/
services.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package state
import (
"github.com/tendermint/tendermint/types"
)
//------------------------------------------------------
// blockchain services types
// NOTE: Interfaces used by RPC must be thread safe!
//------------------------------------------------------
//------------------------------------------------------
// blockstore
// BlockStoreRPC is the block store interface used by the RPC.
type BlockStoreRPC interface {
Height() int64
LoadBlockMeta(height int64) *types.BlockMeta
LoadBlock(height int64) *types.Block
LoadBlockPart(height int64, index int) *types.Part
LoadBlockCommit(height int64) *types.Commit
LoadSeenCommit(height int64) *types.Commit
}
// BlockStore defines the BlockStore interface used by the ConsensusState.
type BlockStore interface {
BlockStoreRPC
SaveBlock(block *types.Block, blockParts *types.PartSet, seenCommit *types.Commit)
}
//-----------------------------------------------------------------------------------------------------
// evidence pool
// EvidencePool defines the EvidencePool interface used by the ConsensusState.
// Get/Set/Commit
type EvidencePool interface {
PendingEvidence(int64) []types.Evidence
AddEvidence(types.Evidence) error
Update(*types.Block, State)
// IsCommitted indicates if this evidence was already marked committed in another block.
IsCommitted(types.Evidence) bool
}
// MockEvidencePool is an empty implementation of a Mempool, useful for testing.
type MockEvidencePool struct{}
func (m MockEvidencePool) PendingEvidence(int64) []types.Evidence { return nil }
func (m MockEvidencePool) AddEvidence(types.Evidence) error { return nil }
func (m MockEvidencePool) Update(*types.Block, State) {}
func (m MockEvidencePool) IsCommitted(types.Evidence) bool { return false }