Skip to content

A possible bug in lastRelevant #710

Closed
@xixisese

Description

The lastRelevant tries to get the latest period relevant to the specified proposal value, the code is:

func (store *proposalStore) lastRelevant(pv proposalValue) (p period, pinned bool) {
if store.Pinned == pv {
pinned = true
return
}
for per := range store.Relevant {
if per > p {
p = per
}
}
return
}

It's possible the result period got from the function has nothing to do with the parameter pv.
shouldn't it be updated as follows?

for per := range store.Relevant {
	if (per > p) && (store.Relevant[per] == pv) {
		p = per
	}
}
return

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions