Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.2.0] Check for result phase at activate method #3492

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ protected void activate() {
cyclesTableView.getSelectionModel().selectedItemProperty().addListener(selectedVoteResultListItemListener);

if (daoStateService.isParseBlockChainComplete()) {
checkForResultPhase(daoStateService.getChainHeight());
fillCycleList();
}

Expand Down Expand Up @@ -238,7 +239,11 @@ protected void deactivate() {

@Override
public void onParseBlockCompleteAfterBatchProcessing(Block block) {
int chainHeight = daoStateService.getChainHeight();
checkForResultPhase(daoStateService.getChainHeight());
fillCycleList();
}

private void checkForResultPhase(int chainHeight) {
if (periodService.getFirstBlockOfPhase(chainHeight, DaoPhase.Phase.RESULT) == chainHeight) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be <= chainHeight?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

periodService.getFirstBlockOfPhase gets the height of the first block of the current phase so this check will return true for all chainHeight in the RESULT phase.

// We had set the cycle initially but at the vote result we want to update it with the actual result.
// We remove the empty cycle to make space for the one with the result.
Expand All @@ -251,8 +256,6 @@ public void onParseBlockCompleteAfterBatchProcessing(Block block) {
.findAny();
optionalCurrentCycleListItem.ifPresent(cycleListItemList::remove);
}

fillCycleList();
}


Expand Down