mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +01:00
Merge pull request #6546 from jmacxx/offer_availability_dao_sync_check
Maker check DAO health when handling OfferAvailabilityRequest.
This commit is contained in:
commit
27613de363
@ -79,6 +79,7 @@ public class BisqHeadlessApp implements HeadlessApp {
|
||||
bisqSetup.setSpvFileCorruptedHandler(msg -> log.error("onSpvFileCorruptedHandler: msg={}", msg));
|
||||
bisqSetup.setChainFileLockedExceptionHandler(msg -> log.error("onChainFileLockedExceptionHandler: msg={}", msg));
|
||||
bisqSetup.setDiskSpaceWarningHandler(msg -> log.error("onDiskSpaceWarningHandler: msg={}", msg));
|
||||
bisqSetup.setChainNotSyncedHandler(msg -> log.error("onChainNotSyncedHandler: msg={}", msg));
|
||||
bisqSetup.setLockedUpFundsHandler(msg -> log.info("onLockedUpFundsHandler: msg={}", msg));
|
||||
bisqSetup.setShowFirstPopupIfResyncSPVRequestedHandler(() -> log.info("onShowFirstPopupIfResyncSPVRequestedHandler"));
|
||||
bisqSetup.setRequestWalletPasswordHandler(aesKeyHandler -> log.info("onRequestWalletPasswordHandler"));
|
||||
|
@ -164,7 +164,7 @@ public class BisqSetup {
|
||||
filterWarningHandler, displaySecurityRecommendationHandler, displayLocalhostHandler,
|
||||
wrongOSArchitectureHandler, displaySignedByArbitratorHandler,
|
||||
displaySignedByPeerHandler, displayPeerLimitLiftedHandler, displayPeerSignerHandler,
|
||||
rejectedTxErrorMessageHandler, diskSpaceWarningHandler;
|
||||
rejectedTxErrorMessageHandler, diskSpaceWarningHandler, chainNotSyncedHandler;
|
||||
@Setter
|
||||
@Nullable
|
||||
private Consumer<Boolean> displayTorNetworkSettingsHandler;
|
||||
@ -481,6 +481,7 @@ public class BisqSetup {
|
||||
daoErrorMessageHandler,
|
||||
daoWarnMessageHandler,
|
||||
filterWarningHandler,
|
||||
chainNotSyncedHandler,
|
||||
voteResultExceptionHandler,
|
||||
revolutAccountsUpdateHandler,
|
||||
amazonGiftCardAccountsUpdateHandler,
|
||||
|
@ -204,6 +204,7 @@ public class DomainInitialisation {
|
||||
Consumer<String> daoErrorMessageHandler,
|
||||
Consumer<String> daoWarnMessageHandler,
|
||||
Consumer<String> filterWarningHandler,
|
||||
Consumer<String> chainNotSyncedHandler,
|
||||
Consumer<VoteResultException> voteResultExceptionHandler,
|
||||
Consumer<List<RevolutAccount>> revolutAccountsUpdateHandler,
|
||||
Consumer<List<AmazonGiftCardAccount>> amazonGiftCardAccountsUpdateHandler,
|
||||
@ -225,6 +226,7 @@ public class DomainInitialisation {
|
||||
failedTradesManager.onAllServicesInitialized();
|
||||
xmrTxProofService.onAllServicesInitialized();
|
||||
|
||||
openOfferManager.setChainNotSyncedHandler(chainNotSyncedHandler);
|
||||
openOfferManager.onAllServicesInitialized();
|
||||
openBsqSwapOfferService.onAllServicesInitialized();
|
||||
|
||||
|
@ -89,9 +89,11 @@ import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@ -133,6 +135,8 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
||||
private final TradableList<OpenOffer> openOffers = new TradableList<>();
|
||||
private boolean stopped;
|
||||
private Timer periodicRepublishOffersTimer, periodicRefreshOffersTimer, retryRepublishOffersTimer;
|
||||
@Setter
|
||||
private Consumer<String> chainNotSyncedHandler;
|
||||
@Getter
|
||||
private final ObservableList<Tuple2<OpenOffer, String>> invalidOffers = FXCollections.observableArrayList();
|
||||
|
||||
@ -653,6 +657,20 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
||||
errorMessage = "We got a handleOfferAvailabilityRequest but our chain is not synced.";
|
||||
log.info(errorMessage);
|
||||
sendAckMessage(request, peer, false, errorMessage);
|
||||
if (chainNotSyncedHandler != null) {
|
||||
chainNotSyncedHandler.accept(Res.get("popup.warning.chainNotSynced"));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't allow trade start if DAO is not fully synced
|
||||
if (!daoFacade.isDaoStateReadyAndInSync()) {
|
||||
errorMessage = "We got a handleOfferAvailabilityRequest but our DAO is not synced.";
|
||||
log.info(errorMessage);
|
||||
sendAckMessage(request, peer, false, errorMessage);
|
||||
if (chainNotSyncedHandler != null) {
|
||||
chainNotSyncedHandler.accept(Res.get("popup.warning.daoNeedsResync"));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -399,7 +399,11 @@ public class MainViewModel implements ViewModel, BisqSetup.BisqSetupListener {
|
||||
new Popup().warning(msg).show();
|
||||
}
|
||||
});
|
||||
|
||||
bisqSetup.setChainNotSyncedHandler(msg -> {
|
||||
if (PopupManager.isNoPopupDisplayed()) {
|
||||
new Popup().warning(msg).show();
|
||||
}
|
||||
});
|
||||
bisqSetup.setLockedUpFundsHandler(msg -> {
|
||||
// repeated popups of the same message text can be stopped by selecting the "Dont show again" checkbox
|
||||
String key = Hex.encode(Hash.getSha256Ripemd160hash(msg.getBytes(Charsets.UTF_8)));
|
||||
|
Loading…
Reference in New Issue
Block a user