mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 18:03:12 +01:00
Use onParseBlockCompleteAfterBatchProcessing to avoid sequence issues
When using onParseBlockChainComplete and onParseBlockCompleteAfterBatchProcessing the onParseBlockCompleteAfterBatchProcessing is called earlier as onParseBlockChainComplete which caused incorrect state update in the UI.
This commit is contained in:
parent
d5c7e0a660
commit
a28805b983
@ -45,7 +45,6 @@ import lombok.extern.slf4j.Slf4j;
|
||||
public class BallotListPresentation implements BallotListService.BallotListChangeListener, DaoStateListener {
|
||||
private final BallotListService ballotListService;
|
||||
private final PeriodService periodService;
|
||||
private final DaoStateService daoStateService;
|
||||
private final ProposalValidatorProvider proposalValidatorProvider;
|
||||
|
||||
@Getter
|
||||
@ -65,31 +64,20 @@ public class BallotListPresentation implements BallotListService.BallotListChang
|
||||
ProposalValidatorProvider proposalValidatorProvider) {
|
||||
this.ballotListService = ballotListService;
|
||||
this.periodService = periodService;
|
||||
this.daoStateService = daoStateService;
|
||||
this.proposalValidatorProvider = proposalValidatorProvider;
|
||||
|
||||
daoStateService.addDaoStateListener(this);
|
||||
ballotListService.addListener(this);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// DaoStateListener
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void onNewBlockHeight(int blockHeight) {
|
||||
if (daoStateService.isParseBlockChainComplete()) {
|
||||
ballotsOfCycle.setPredicate(ballot -> periodService.isTxInCorrectCycle(ballot.getTxId(), blockHeight));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onParseBlockChainComplete() {
|
||||
ballotsOfCycle.setPredicate(ballot -> periodService.isTxInCorrectCycle(ballot.getTxId(), daoStateService.getChainHeight()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onParseBlockCompleteAfterBatchProcessing(Block block) {
|
||||
ballotsOfCycle.setPredicate(ballot -> periodService.isTxInCorrectCycle(ballot.getTxId(), block.getHeight()));
|
||||
onListChanged(ballotListService.getValidatedBallotList());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user