diff --git a/src/main/java/bisq/core/app/BisqSetup.java b/src/main/java/bisq/core/app/BisqSetup.java index 1f5a4d89..12dd7750 100644 --- a/src/main/java/bisq/core/app/BisqSetup.java +++ b/src/main/java/bisq/core/app/BisqSetup.java @@ -606,10 +606,12 @@ public void onBalanceChanged(Coin balance, Transaction tx) { feeService.onAllServicesInitialized(); - daoSetup.onAllServicesInitialized(errorMessage -> { - if (daoSetupErrorHandler != null) - daoSetupErrorHandler.accept(errorMessage); - }); + if (DevEnv.isDaoActivated()) { + daoSetup.onAllServicesInitialized(errorMessage -> { + if (daoSetupErrorHandler != null) + daoSetupErrorHandler.accept(errorMessage); + }); + } tradeStatisticsManager.onAllServicesInitialized(); diff --git a/src/main/java/bisq/core/dao/DaoFacade.java b/src/main/java/bisq/core/dao/DaoFacade.java index 1399b06a..7aa6d381 100644 --- a/src/main/java/bisq/core/dao/DaoFacade.java +++ b/src/main/java/bisq/core/dao/DaoFacade.java @@ -70,6 +70,7 @@ import javafx.beans.property.SimpleObjectProperty; import javafx.collections.ObservableList; +import javafx.collections.transformation.FilteredList; import java.util.List; import java.util.Optional; @@ -259,6 +260,10 @@ public ObservableList getBallots() { return ballotListPresentation.getBallots(); } + public FilteredList getBallotsOfCycle() { + return ballotListPresentation.getBallotsOfCycle(); + } + public Tuple2 getMeritAndStakeForProposal(String proposalTxId) { return myVoteListService.getMeritAndStakeForProposal(proposalTxId, myBlindVoteListService); } diff --git a/src/main/java/bisq/core/dao/governance/ballot/BallotListPresentation.java b/src/main/java/bisq/core/dao/governance/ballot/BallotListPresentation.java index 8e5792a7..65d50ef7 100644 --- a/src/main/java/bisq/core/dao/governance/ballot/BallotListPresentation.java +++ b/src/main/java/bisq/core/dao/governance/ballot/BallotListPresentation.java @@ -27,6 +27,7 @@ import javafx.collections.FXCollections; import javafx.collections.ObservableList; +import javafx.collections.transformation.FilteredList; import java.util.List; @@ -39,9 +40,13 @@ @Slf4j public class BallotListPresentation implements BallotListService.BallotListChangeListener, BsqStateListener { private final BallotListService ballotListService; + private final PeriodService periodService; + private final BsqStateService bsqStateService; @Getter private final ObservableList ballots = FXCollections.observableArrayList(); + @Getter + private final FilteredList ballotsOfCycle = new FilteredList<>(ballots); /////////////////////////////////////////////////////////////////////////////////////////// @@ -54,6 +59,8 @@ public BallotListPresentation(BallotListService ballotListService, BsqStateService bsqStateService, ProposalValidator proposalValidator) { this.ballotListService = ballotListService; + this.periodService = periodService; + this.bsqStateService = bsqStateService; bsqStateService.addBsqStateListener(this); ballotListService.addListener(this); @@ -70,6 +77,8 @@ public void onNewBlockHeight(int blockHeight) { @Override public void onParseTxsComplete(Block block) { onListChanged(ballotListService.getBallotList().getList()); + + ballotsOfCycle.setPredicate(ballot -> periodService.isTxInCorrectCycle(ballot.getTxId(), bsqStateService.getChainHeight())); } @Override diff --git a/src/main/java/bisq/core/dao/node/full/FullNode.java b/src/main/java/bisq/core/dao/node/full/FullNode.java index fcaba975..05b9ac7d 100644 --- a/src/main/java/bisq/core/dao/node/full/FullNode.java +++ b/src/main/java/bisq/core/dao/node/full/FullNode.java @@ -149,7 +149,7 @@ private void addBlockHandler() { private void onNewBlock(Block block) { jsonBlockChainExporter.maybeExport(); - if (p2pNetworkReady) + if (p2pNetworkReady && parseBlockchainComplete) fullNodeNetworkService.publishNewBlock(block); } diff --git a/src/main/java/bisq/core/dao/node/full/network/FullNodeNetworkService.java b/src/main/java/bisq/core/dao/node/full/network/FullNodeNetworkService.java index fd579415..4f19f596 100644 --- a/src/main/java/bisq/core/dao/node/full/network/FullNodeNetworkService.java +++ b/src/main/java/bisq/core/dao/node/full/network/FullNodeNetworkService.java @@ -98,7 +98,7 @@ public void shutDown() { public void publishNewBlock(Block block) { log.info("Publish new block at height={} and block hash={}", block.getHeight(), block.getHash()); RawBlock rawBlock = RawBlock.fromBlock(block); - final NewBlockBroadcastMessage newBlockBroadcastMessage = new NewBlockBroadcastMessage(rawBlock); + NewBlockBroadcastMessage newBlockBroadcastMessage = new NewBlockBroadcastMessage(rawBlock); broadcaster.broadcast(newBlockBroadcastMessage, networkNode.getNodeAddress(), null, true); } diff --git a/src/main/java/bisq/core/dao/node/messages/NewBlockBroadcastMessage.java b/src/main/java/bisq/core/dao/node/messages/NewBlockBroadcastMessage.java index d9553158..0d565e50 100644 --- a/src/main/java/bisq/core/dao/node/messages/NewBlockBroadcastMessage.java +++ b/src/main/java/bisq/core/dao/node/messages/NewBlockBroadcastMessage.java @@ -20,12 +20,18 @@ import bisq.core.dao.state.blockchain.RawBlock; import bisq.network.p2p.storage.messages.BroadcastMessage; +import bisq.network.p2p.storage.payload.CapabilityRequiringPayload; +import bisq.common.app.Capabilities; import bisq.common.app.Version; import bisq.common.proto.network.NetworkEnvelope; import io.bisq.generated.protobuffer.PB; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + import lombok.EqualsAndHashCode; import lombok.Getter; @@ -33,7 +39,7 @@ // nodes when they receive the NewBlockBroadcastMessage! @EqualsAndHashCode(callSuper = true) @Getter -public final class NewBlockBroadcastMessage extends BroadcastMessage { +public final class NewBlockBroadcastMessage extends BroadcastMessage implements CapabilityRequiringPayload { private final RawBlock block; public NewBlockBroadcastMessage(RawBlock block) { @@ -62,4 +68,11 @@ public static NetworkEnvelope fromProto(PB.NewBlockBroadcastMessage proto, int m return new NewBlockBroadcastMessage(RawBlock.fromProto(proto.getRawBlock()), messageVersion); } + + @Override + public List getRequiredCapabilities() { + return new ArrayList<>(Collections.singletonList( + Capabilities.Capability.BSQ_BLOCK.ordinal() + )); + } } diff --git a/src/main/java/bisq/core/notifications/alerts/TradeEvents.java b/src/main/java/bisq/core/notifications/alerts/TradeEvents.java index 50bd4986..43f51ec8 100644 --- a/src/main/java/bisq/core/notifications/alerts/TradeEvents.java +++ b/src/main/java/bisq/core/notifications/alerts/TradeEvents.java @@ -65,7 +65,6 @@ private void setTradePhaseListener(Trade trade) { if (!trade.isPayoutPublished()) { trade.statePhaseProperty().addListener((observable, oldValue, newValue) -> { String msg = null; - log.error("setTradePhaseListener phase " + newValue); String shortId = trade.getShortId(); switch (newValue) { case INIT: diff --git a/src/main/java/bisq/core/setup/CoreNetworkCapabilities.java b/src/main/java/bisq/core/setup/CoreNetworkCapabilities.java index a39afcd3..5d0c55f4 100644 --- a/src/main/java/bisq/core/setup/CoreNetworkCapabilities.java +++ b/src/main/java/bisq/core/setup/CoreNetworkCapabilities.java @@ -31,14 +31,17 @@ public static void setSupportedCapabilities(BisqEnvironment bisqEnvironment) { Capabilities.Capability.TRADE_STATISTICS.ordinal(), Capabilities.Capability.TRADE_STATISTICS_2.ordinal(), Capabilities.Capability.ACCOUNT_AGE_WITNESS.ordinal(), - Capabilities.Capability.ACK_MSG.ordinal(), - Capabilities.Capability.PROPOSAL.ordinal(), - Capabilities.Capability.BLIND_VOTE.ordinal() + Capabilities.Capability.ACK_MSG.ordinal() )); - Boolean fullDaoNode = bisqEnvironment.getProperty(DaoOptionKeys.FULL_DAO_NODE, Boolean.class, false); - if (fullDaoNode) - supportedCapabilities.add(Capabilities.Capability.DAO_FULL_NODE.ordinal()); + if (bisqEnvironment.getProperty(DaoOptionKeys.DAO_ACTIVATED, Boolean.class, false)) { + supportedCapabilities.add(Capabilities.Capability.PROPOSAL.ordinal()); + supportedCapabilities.add(Capabilities.Capability.BLIND_VOTE.ordinal()); + supportedCapabilities.add(Capabilities.Capability.BSQ_BLOCK.ordinal()); + + if (bisqEnvironment.getProperty(DaoOptionKeys.FULL_DAO_NODE, Boolean.class, false)) + supportedCapabilities.add(Capabilities.Capability.DAO_FULL_NODE.ordinal()); + } Capabilities.setSupportedCapabilities(supportedCapabilities); } diff --git a/src/main/java/bisq/core/user/Preferences.java b/src/main/java/bisq/core/user/Preferences.java index 731e0f9f..15e830e1 100644 --- a/src/main/java/bisq/core/user/Preferences.java +++ b/src/main/java/bisq/core/user/Preferences.java @@ -279,6 +279,15 @@ else if (useTorFlagFromOptions.equals("true")) if (referralIdFromOptions != null && !referralIdFromOptions.isEmpty()) setReferralId(referralIdFromOptions); + // For users from old versions the 4 flags a false but we want to have it true by default + // PhoneKeyAndToken is also null so we can use that to enable the flags + if (prefPayload.getPhoneKeyAndToken() == null) { + setUseSoundForMobileNotifications(true); + setUseTradeNotifications(true); + setUseMarketNotifications(true); + setUsePriceNotifications(true); + } + initialReadDone = true; persist(); }