Skip to content

Commit

Permalink
Merge pull request bisq-network#2757 from sqrrm/count-voting-cycles
Browse files Browse the repository at this point in the history
Count cycles correctly, fix bisq-network#2706
  • Loading branch information
ManfredKarrer authored Apr 21, 2019
2 parents eb1c4fd + d0c0bd9 commit 25931c0
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ public void addFirstCycle() {
}

public int getCycleIndex(Cycle cycle) {
return (cycle.getHeightOfFirstBlock() - genesisBlockHeight) / cycle.getDuration();
Optional<Cycle> previousCycle = getCycle(cycle.getHeightOfFirstBlock() - 1, daoStateService.getCycles());
return previousCycle.map(cycle1 -> getCycleIndex(cycle1) + 1).orElse(0);
}

public boolean isTxInCycle(Cycle cycle, String txId) {
Expand Down

0 comments on commit 25931c0

Please sign in to comment.