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

Dao fix majorityvote issue #2371

Merged
Merged
Show file tree
Hide file tree
Changes from 10 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
2 changes: 2 additions & 0 deletions common/src/main/java/bisq/common/util/PermutationUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ public static <T> List<T> getPartialList(List<T> list, List<Integer> indicesToRe
return altered;
}

//TODO optimize algorithm so that it starts from all objects and goes down instead starting with from the bottom.
// That should help that we are not hitting the iteration limit so easily.
/**
* Returns a list of all possible permutations of a give sorted list ignoring duplicates.
* E.g. List [A,B,C] results in this list of permutations: [[A], [B], [A,B], [C], [A,C], [B,C], [A,B,C]]
Expand Down
8 changes: 0 additions & 8 deletions core/src/main/java/bisq/core/btc/wallet/BsqWalletService.java
Original file line number Diff line number Diff line change
Expand Up @@ -182,20 +182,12 @@ public void onWalletChanged(Wallet wallet) {
// DaoStateListener
///////////////////////////////////////////////////////////////////////////////////////////

@Override
public void onNewBlockHeight(int blockHeight) {
}

@Override
public void onParseTxsCompleteAfterBatchProcessing(Block block) {
if (isWalletReady())
updateBsqWalletTransactions();
}

@Override
public void onParseBlockChainComplete() {
}


///////////////////////////////////////////////////////////////////////////////////////////
// Overridden Methods
Expand Down
4 changes: 0 additions & 4 deletions core/src/main/java/bisq/core/dao/DaoFacade.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,6 @@ public void onNewBlockHeight(int blockHeight) {
if (blockHeight > 0 && periodService.getCurrentCycle() != null)
periodService.getCurrentCycle().getPhaseForHeight(blockHeight).ifPresent(phaseProperty::set);
}

@Override
public void onParseBlockChainComplete() {
}
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,6 @@ private List<Tx> getFeeTxs(StatefulAsset statefulAsset) {
// DaoStateListener
///////////////////////////////////////////////////////////////////////////////////////////

@Override
public void onNewBlockHeight(int blockHeight) {
}

@Override
public void onParseTxsCompleteAfterBatchProcessing(Block block) {
int chainHeight = daoStateService.getChainHeight();
Expand All @@ -283,10 +279,6 @@ public void onParseTxsCompleteAfterBatchProcessing(Block block) {

}

@Override
public void onParseBlockChainComplete() {
}


///////////////////////////////////////////////////////////////////////////////////////////
// API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public BallotListPresentation(BallotListService ballotListService,

@Override
public void onNewBlockHeight(int blockHeight) {
//TODO should it be in onParseTxsComplete?
ballotsOfCycle.setPredicate(ballot -> periodService.isTxInCorrectCycle(ballot.getTxId(), blockHeight));
}

Expand All @@ -82,12 +83,6 @@ public void onParseTxsCompleteAfterBatchProcessing(Block block) {
onListChanged(ballotListService.getValidatedBallotList());
}

@Override
public void onParseBlockChainComplete() {
// As we update the list in ProposalService.onParseBlockChainComplete we need to update here as well.
onListChanged(ballotListService.getValidatedBallotList());
}


///////////////////////////////////////////////////////////////////////////////////////////
// BallotListService.BallotListChangeListener
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,6 @@ public void start() {
// DaoStateListener
///////////////////////////////////////////////////////////////////////////////////////////

@Override
public void onNewBlockHeight(int blockHeight) {
}

@Override
public void onParseBlockChainComplete() {
fillListFromAppendOnlyDataStore();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,6 @@ public void readPersisted() {
// DaoStateListener
///////////////////////////////////////////////////////////////////////////////////////////

@Override
public void onNewBlockHeight(int blockHeight) {
}

@Override
public void onParseBlockChainComplete() {
rePublishOnceWellConnected();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,18 +156,10 @@ public BondRepository(DaoStateService daoStateService, BsqWalletService bsqWalle
@Override
public void addListeners() {
daoStateService.addBsqStateListener(new DaoStateListener() {
@Override
public void onNewBlockHeight(int blockHeight) {
}

@Override
public void onParseTxsCompleteAfterBatchProcessing(Block block) {
update();
}

@Override
public void onParseBlockChainComplete() {
}
});
bsqWalletService.getWalletTransactions().addListener((ListChangeListener<Transaction>) c -> update());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,10 @@ public MyBondedReputationRepository(DaoStateService daoStateService,
@Override
public void addListeners() {
daoStateService.addBsqStateListener(new DaoStateListener() {
@Override
public void onNewBlockHeight(int blockHeight) {
}

@Override
public void onParseTxsCompleteAfterBatchProcessing(Block block) {
update();
}

@Override
public void onParseBlockChainComplete() {
}
});
bsqWalletService.getWalletTransactions().addListener((ListChangeListener<Transaction>) c -> update());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@ public void onNewBlockHeight(int blockHeight) {
.ifPresent(daoStateService.getCycles()::add);
}

@Override
public void onParseBlockChainComplete() {
}


///////////////////////////////////////////////////////////////////////////////////////////
// API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,19 +120,11 @@ public void updateList() {
// DaoStateListener
///////////////////////////////////////////////////////////////////////////////////////////

@Override
public void onNewBlockHeight(int blockHeight) {
}

@Override
public void onParseTxsCompleteAfterBatchProcessing(Block block) {
updateList();
}

@Override
public void onParseBlockChainComplete() {
}


///////////////////////////////////////////////////////////////////////////////////////////
// API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,6 @@ public void readPersisted() {
// DaoStateListener
///////////////////////////////////////////////////////////////////////////////////////////

@Override
public void onNewBlockHeight(int blockHeight) {
}

@Override
public void onParseBlockChainComplete() {
rePublishOnceWellConnected();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,20 +90,11 @@ public ProposalListPresentation(ProposalService proposalService,
// DaoStateListener
///////////////////////////////////////////////////////////////////////////////////////////

// At new cycle we don't get a list change but we want to update our predicates
@Override
public void onNewBlockHeight(int blockHeight) {
}

@Override
public void onParseTxsCompleteAfterBatchProcessing(Block block) {
updateLists();
}

@Override
public void onParseBlockChainComplete() {
}


///////////////////////////////////////////////////////////////////////////////////////////
// MyProposalListService.Listener
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,6 @@ public void onAdded(PersistableNetworkPayload payload) {
// DaoStateListener
///////////////////////////////////////////////////////////////////////////////////////////

@Override
public void onNewBlockHeight(int blockHeight) {
}

@Override
public void onParseTxsCompleteAfterBatchProcessing(Block block) {
int heightForRepublishing = periodService.getFirstBlockOfPhase(daoStateService.getChainHeight(), DaoPhase.Phase.BREAK1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import lombok.Getter;
import lombok.Value;

@EqualsAndHashCode(callSuper = true)
public class VoteResultException extends Exception {
@Getter
private final int heightOfFirstBlockInCycle;
Expand Down Expand Up @@ -83,24 +84,6 @@ private MissingDataException(String message) {
}
}

@EqualsAndHashCode(callSuper = true)
@Value
public static class MissingBlindVoteDataException extends MissingDataException {
private String blindVoteTxId;

MissingBlindVoteDataException(String blindVoteTxId) {
super("Blind vote tx ID " + blindVoteTxId + " is missing");
this.blindVoteTxId = blindVoteTxId;
}

@Override
public String toString() {
return "MissingBlindVoteDataException{" +
"\n blindVoteTxId='" + blindVoteTxId + '\'' +
"\n} " + super.toString();
}
}

@EqualsAndHashCode(callSuper = true)
@Value
public static class MissingBallotException extends MissingDataException {
Expand Down
Loading