mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-20 10:22:18 +01:00
Cleanup
This commit is contained in:
parent
3a16897350
commit
34bbe4678f
@ -59,9 +59,7 @@ import org.spongycastle.crypto.params.KeyParameter;
|
|||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@ -174,11 +172,9 @@ public class TradeManager {
|
|||||||
private void initPendingTrades() {
|
private void initPendingTrades() {
|
||||||
if (firstPeerAuthenticatedListener != null) p2PService.removeP2PServiceListener(firstPeerAuthenticatedListener);
|
if (firstPeerAuthenticatedListener != null) p2PService.removeP2PServiceListener(firstPeerAuthenticatedListener);
|
||||||
|
|
||||||
List<Trade> failedTrades = new ArrayList<>();
|
//List<Trade> failedTrades = new ArrayList<>();
|
||||||
for (Trade trade : trades) {
|
for (Trade trade : trades) {
|
||||||
// We continue an interrupted trade.
|
// We continue an interrupted trade.
|
||||||
// TODO if the peer has changed its IP address, we need to make another findPeer request. At the moment we use the peer stored in trade to
|
|
||||||
// continue the trade, but that might fail.
|
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
/* if (trade.isFailedState()) {
|
/* if (trade.isFailedState()) {
|
||||||
@ -200,7 +196,7 @@ public class TradeManager {
|
|||||||
}
|
}
|
||||||
pendingTradesInitialized.set(true);
|
pendingTradesInitialized.set(true);
|
||||||
|
|
||||||
failedTrades.stream().filter(Trade::isTakerFeePaid).forEach(this::addTradeToFailedTrades);
|
//failedTrades.stream().filter(Trade::isTakerFeePaid).forEach(this::addTradeToFailedTrades);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleInitialTakeOfferRequest(TradeMessage message, Address peerAddress) {
|
private void handleInitialTakeOfferRequest(TradeMessage message, Address peerAddress) {
|
||||||
|
@ -43,6 +43,7 @@ public class FailedTradesManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void add(Trade trade) {
|
public void add(Trade trade) {
|
||||||
|
if (!failedTrades.contains(trade))
|
||||||
failedTrades.add(trade);
|
failedTrades.add(trade);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ import io.bitsquare.p2p.messaging.DecryptedMsgWithPubKey;
|
|||||||
import io.bitsquare.trade.OffererTrade;
|
import io.bitsquare.trade.OffererTrade;
|
||||||
import io.bitsquare.trade.TakerTrade;
|
import io.bitsquare.trade.TakerTrade;
|
||||||
import io.bitsquare.trade.Trade;
|
import io.bitsquare.trade.Trade;
|
||||||
|
import io.bitsquare.trade.TradeManager;
|
||||||
import io.bitsquare.trade.protocol.trade.messages.TradeMessage;
|
import io.bitsquare.trade.protocol.trade.messages.TradeMessage;
|
||||||
import io.bitsquare.trade.protocol.trade.tasks.shared.SetupPayoutTxLockTimeReachedListener;
|
import io.bitsquare.trade.protocol.trade.tasks.shared.SetupPayoutTxLockTimeReachedListener;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@ -157,10 +158,11 @@ public abstract class TradeProtocol {
|
|||||||
boolean isTakerTrade = trade instanceof TakerTrade;
|
boolean isTakerTrade = trade instanceof TakerTrade;
|
||||||
|
|
||||||
if (isTakerTrade) {
|
if (isTakerTrade) {
|
||||||
|
TradeManager tradeManager = processModel.getTradeManager();
|
||||||
if (tradeState.getPhase() == Trade.Phase.PREPARATION) {
|
if (tradeState.getPhase() == Trade.Phase.PREPARATION) {
|
||||||
processModel.getTradeManager().removePreparedTrade(trade);
|
tradeManager.removePreparedTrade(trade);
|
||||||
} else if (tradeState.getPhase() == Trade.Phase.TAKER_FEE_PAID) {
|
} else if (tradeState.getPhase() == Trade.Phase.TAKER_FEE_PAID) {
|
||||||
processModel.getTradeManager().addTradeToFailedTrades(trade);
|
tradeManager.addTradeToFailedTrades(trade);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ public class SetupDepositBalanceListener extends TradeTask {
|
|||||||
trade.setState(Trade.State.DEPOSIT_SEEN_IN_NETWORK);
|
trade.setState(Trade.State.DEPOSIT_SEEN_IN_NETWORK);
|
||||||
} else if (tradeState.getPhase() == Trade.Phase.PREPARATION) {
|
} else if (tradeState.getPhase() == Trade.Phase.PREPARATION) {
|
||||||
processModel.getTradeManager().removePreparedTrade(trade);
|
processModel.getTradeManager().removePreparedTrade(trade);
|
||||||
} else if (tradeState.getPhase().ordinal() < Trade.Phase.DEPOSIT_PAID.ordinal()) {
|
} else if (tradeState.getPhase().ordinal() < Trade.Phase.DEPOSIT_PAID.ordinal()) { // TODO need to evaluate if that is correct
|
||||||
processModel.getTradeManager().addTradeToFailedTrades(trade);
|
processModel.getTradeManager().addTradeToFailedTrades(trade);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ public class MarketsStatisticsView extends ActivatableViewAndModel<GridPane, Mar
|
|||||||
statisticsTableView.getColumns().add(getTotalAmountColumn());
|
statisticsTableView.getColumns().add(getTotalAmountColumn());
|
||||||
statisticsTableView.getColumns().add(getSpreadColumn());
|
statisticsTableView.getColumns().add(getSpreadColumn());
|
||||||
statisticsTableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
|
statisticsTableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
|
||||||
Label placeholder = new Label("Currently there are no offers available");
|
Label placeholder = new Label("Currently there is no data available");
|
||||||
placeholder.setWrapText(true);
|
placeholder.setWrapText(true);
|
||||||
statisticsTableView.setPlaceholder(placeholder);
|
statisticsTableView.setPlaceholder(placeholder);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user