minor fixes from review

This commit is contained in:
Ethan Buchman
2017-11-20 18:59:10 +00:00
parent 0f293bfc2b
commit 5904f6df8b
2 changed files with 6 additions and 5 deletions

View File

@@ -36,7 +36,7 @@ func (evpool *EvidencePool) SetLogger(l log.Logger) {
}
// EvidenceChan returns an unbuffered channel on which new evidence can be received.
func (evpool *EvidencePool) EvidenceChan() chan types.Evidence {
func (evpool *EvidencePool) EvidenceChan() <-chan types.Evidence {
return evpool.evidenceChan
}

View File

@@ -85,7 +85,7 @@ func (store *EvidenceStore) PriorityEvidence() (evidence []types.Evidence) {
// reverse the order so highest priority is first
l := store.ListEvidence(baseKeyOutqueue)
l2 := make([]types.Evidence, len(l))
for i, _ := range l {
for i := range l {
l2[i] = l[len(l)-1-i]
}
return l2
@@ -118,12 +118,13 @@ func (store *EvidenceStore) GetEvidence(height int, hash []byte) *EvidenceInfo {
if len(val) == 0 {
return nil
}
ei := new(EvidenceInfo)
wire.ReadBinaryBytes(val, ei)
return ei
var ei EvidenceInfo
wire.ReadBinaryBytes(val, &ei)
return &ei
}
// AddNewEvidence adds the given evidence to the database.
// It returns false if the evidence is already stored.
func (store *EvidenceStore) AddNewEvidence(evidence types.Evidence, priority int) bool {
// check if we already have seen it
ei_ := store.GetEvidence(evidence.Height(), evidence.Hash())