evidence: modularise evidence by moving verification function into evidence package (#5234)

This commit is contained in:
Callum Waters
2020-08-20 18:11:21 +02:00
committed by GitHub
parent 8ca24e2f5a
commit b7f6e47a42
19 changed files with 547 additions and 718 deletions

View File

@@ -35,7 +35,7 @@ type BlockStore interface {
//-----------------------------------------------------------------------------
// evidence pool
//go:generate mockery -case underscore -name EvidencePool
//go:generate mockery --case underscore --name EvidencePool
// EvidencePool defines the EvidencePool interface used by the ConsensusState.
// Get/Set/Commit
@@ -43,9 +43,7 @@ type EvidencePool interface {
PendingEvidence(uint32) []types.Evidence
AddEvidence(types.Evidence) error
Update(*types.Block, State)
IsCommitted(types.Evidence) bool
IsPending(types.Evidence) bool
Header(int64) *types.Header
Verify(types.Evidence) error
}
// MockEvidencePool is an empty implementation of EvidencePool, useful for testing.
@@ -54,6 +52,4 @@ type MockEvidencePool struct{}
func (me MockEvidencePool) PendingEvidence(uint32) []types.Evidence { return nil }
func (me MockEvidencePool) AddEvidence(types.Evidence) error { return nil }
func (me MockEvidencePool) Update(*types.Block, State) {}
func (me MockEvidencePool) IsCommitted(types.Evidence) bool { return false }
func (me MockEvidencePool) IsPending(types.Evidence) bool { return false }
func (me MockEvidencePool) Header(int64) *types.Header { return nil }
func (me MockEvidencePool) Verify(types.Evidence) error { return nil }