Merge pull request #3245 from chimp1984/bug-fixes-for-rc-1.1.6

Bug fixes for rc 1.1.6
This commit is contained in:
Christoph Atteneder 2019-09-11 20:42:43 +02:00 committed by GitHub
commit 23876519b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 30 deletions

View File

@ -21,7 +21,6 @@ import bisq.core.btc.setup.WalletsSetup;
import bisq.core.locale.Res;
import bisq.core.support.SupportManager;
import bisq.core.support.SupportType;
import bisq.core.support.dispute.messages.DisputeResultMessage;
import bisq.core.support.messages.ChatMessage;
import bisq.core.support.messages.SupportMessage;
import bisq.core.trade.Trade;
@ -39,7 +38,6 @@ import javax.inject.Singleton;
import javafx.collections.ObservableList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;
@ -50,13 +48,6 @@ public class TraderChatManager extends SupportManager {
private final TradeManager tradeManager;
private final PubKeyRing pubKeyRing;
public interface DisputeStateListener {
void onDisputeClosed(String tradeId);
}
// Needed to avoid ConcurrentModificationException as we remove a listener at the handler call
private List<DisputeStateListener> disputeStateListeners = new CopyOnWriteArrayList<>();
///////////////////////////////////////////////////////////////////////////////////////////
// Constructor
@ -147,23 +138,12 @@ public class TraderChatManager extends SupportManager {
// API
///////////////////////////////////////////////////////////////////////////////////////////
public void addDisputeStateListener(TraderChatManager.DisputeStateListener disputeStateListener) {
disputeStateListeners.add(disputeStateListener);
}
public void removeDisputeStateListener(TraderChatManager.DisputeStateListener disputeStateListener) {
disputeStateListeners.remove(disputeStateListener);
}
public void dispatchMessage(SupportMessage message) {
if (canProcessMessage(message)) {
log.info("Received {} with tradeId {} and uid {}",
message.getClass().getSimpleName(), message.getTradeId(), message.getUid());
if (message instanceof ChatMessage) {
onChatMessage((ChatMessage) message);
} else if (message instanceof DisputeResultMessage) {
// We notify about dispute closed state
disputeStateListeners.forEach(e -> e.onDisputeClosed(message.getTradeId()));
} else {
log.warn("Unsupported message at dispatchMessage. message={}", message);
}

View File

@ -668,7 +668,7 @@ public abstract class Trade implements Tradable, Model {
///////////////////////////////////////////////////////////////////////////////////////////
public void setState(State state) {
log.debug("Set new state at {} (id={}): {}", this.getClass().getSimpleName(), getShortId(), state);
log.info("Set new state at {} (id={}): {}", this.getClass().getSimpleName(), getShortId(), state);
if (state.getPhase().ordinal() < this.state.getPhase().ordinal()) {
String message = "We got a state change to a previous phase.\n" +
"Old state is: " + this.state + ". New state is: " + state;

View File

@ -98,7 +98,7 @@ public class MakerProcessPayDepositRequest extends TradeTask {
"payDepositRequest.getMediatorNodeAddress() must not be null");
trade.setMediatorNodeAddress(mediatorNodeAddress);
Mediator mediator = checkNotNull(user.getAcceptedMediatorByAddress(mediatorNodeAddress),
"user.getAcceptedArbitratorByAddress(arbitratorNodeAddress) must not be null");
"user.getAcceptedMediatorByAddress(mediatorNodeAddress) must not be null");
trade.setMediatorPubKeyRing(checkNotNull(mediator.getPubKeyRing(),
"mediator.getPubKeyRing() must not be null"));

View File

@ -52,7 +52,6 @@ public class SendMediatedPayoutSignatureMessage extends TradeTask {
Contract contract = checkNotNull(trade.getContract(), "contract must not be null");
PubKeyRing peersPubKeyRing = contract.getPeersPubKeyRing(pubKeyRing);
NodeAddress peersNodeAddress = contract.getPeersNodeAddress(pubKeyRing);
log.error("sendBuyerSendPayoutSignatureMessage to peerAddress " + peersNodeAddress);
P2PService p2PService = processModel.getP2PService();
MediatedPayoutTxSignatureMessage message = new MediatedPayoutTxSignatureMessage(processModel.getMediatedPayoutTxSignature(),
trade.getId(),

View File

@ -32,6 +32,7 @@ import bisq.desktop.util.FormBuilder;
import bisq.core.alert.PrivateNotificationManager;
import bisq.core.app.AppOptionKeys;
import bisq.core.locale.Res;
import bisq.core.support.dispute.mediation.MediationResultState;
import bisq.core.support.messages.ChatMessage;
import bisq.core.support.traderchat.TradeChatSession;
import bisq.core.support.traderchat.TraderChatManager;
@ -124,7 +125,9 @@ public class PendingTradesView extends ActivatableViewAndModel<VBox, PendingTrad
private Map<String, Button> buttonByTrade = new HashMap<>();
private Map<String, JFXBadge> badgeByTrade = new HashMap<>();
private Map<String, ListChangeListener<ChatMessage>> listenerByTrade = new HashMap<>();
private TraderChatManager.DisputeStateListener disputeStateListener;
private ChangeListener<Trade.State> tradeStateListener;
private ChangeListener<Trade.DisputeState> disputeStateListener;
private ChangeListener<MediationResultState> mediationResultStateListener;
///////////////////////////////////////////////////////////////////////////////////////////
@ -354,12 +357,30 @@ public class PendingTradesView extends ActivatableViewAndModel<VBox, PendingTrad
boolean isTaker = !model.dataModel.isMaker(trade.getOffer());
TradeChatSession tradeChatSession = new TradeChatSession(trade, isTaker);
disputeStateListener = tradeId -> {
if (trade.getId().equals(tradeId)) {
tradeStateListener = (observable, oldValue, newValue) -> {
if (trade.isPayoutPublished()) {
if (chatPopupStage.isShowing()) {
chatPopupStage.hide();
}
}
};
trade.stateProperty().addListener(tradeStateListener);
disputeStateListener = (observable, oldValue, newValue) -> {
if (newValue == Trade.DisputeState.DISPUTE_CLOSED) {
chatPopupStage.hide();
}
};
traderChatManager.addDisputeStateListener(disputeStateListener);
trade.disputeStateProperty().addListener(disputeStateListener);
mediationResultStateListener = (observable, oldValue, newValue) -> {
if (newValue == MediationResultState.PAYOUT_TX_PUBLISHED ||
newValue == MediationResultState.RECEIVED_PAYOUT_TX_PUBLISHED_MSG ||
newValue == MediationResultState.PAYOUT_TX_SEEN_IN_NETWORK) {
chatPopupStage.hide();
}
};
trade.mediationResultStateProperty().addListener(mediationResultStateListener);
chatView.display(tradeChatSession, pane.widthProperty());
@ -386,9 +407,10 @@ public class PendingTradesView extends ActivatableViewAndModel<VBox, PendingTrad
if (yPositionListener != null) {
chatPopupStage.xProperty().removeListener(yPositionListener);
}
if (disputeStateListener != null) {
traderChatManager.removeDisputeStateListener(disputeStateListener);
}
trade.stateProperty().removeListener(tradeStateListener);
trade.disputeStateProperty().addListener(disputeStateListener);
trade.mediationResultStateProperty().addListener(mediationResultStateListener);
});
Scene scene = new Scene(pane);