This commit is contained in:
Manfred Karrer 2016-01-20 02:55:55 +01:00
parent 3a16897350
commit 34bbe4678f
5 changed files with 11 additions and 12 deletions

View File

@ -59,9 +59,7 @@ import org.spongycastle.crypto.params.KeyParameter;
import javax.inject.Inject;
import javax.inject.Named;
import java.io.File;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
@ -174,13 +172,11 @@ public class TradeManager {
private void initPendingTrades() {
if (firstPeerAuthenticatedListener != null) p2PService.removeP2PServiceListener(firstPeerAuthenticatedListener);
List<Trade> failedTrades = new ArrayList<>();
//List<Trade> failedTrades = new ArrayList<>();
for (Trade trade : trades) {
// 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()) {
failedTrades.add(trade);
}
@ -200,7 +196,7 @@ public class TradeManager {
}
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) {

View File

@ -43,7 +43,8 @@ public class FailedTradesManager {
}
public void add(Trade trade) {
failedTrades.add(trade);
if (!failedTrades.contains(trade))
failedTrades.add(trade);
}
public boolean wasMyOffer(Offer offer) {

View File

@ -26,6 +26,7 @@ import io.bitsquare.p2p.messaging.DecryptedMsgWithPubKey;
import io.bitsquare.trade.OffererTrade;
import io.bitsquare.trade.TakerTrade;
import io.bitsquare.trade.Trade;
import io.bitsquare.trade.TradeManager;
import io.bitsquare.trade.protocol.trade.messages.TradeMessage;
import io.bitsquare.trade.protocol.trade.tasks.shared.SetupPayoutTxLockTimeReachedListener;
import org.slf4j.Logger;
@ -157,10 +158,11 @@ public abstract class TradeProtocol {
boolean isTakerTrade = trade instanceof TakerTrade;
if (isTakerTrade) {
TradeManager tradeManager = processModel.getTradeManager();
if (tradeState.getPhase() == Trade.Phase.PREPARATION) {
processModel.getTradeManager().removePreparedTrade(trade);
tradeManager.removePreparedTrade(trade);
} else if (tradeState.getPhase() == Trade.Phase.TAKER_FEE_PAID) {
processModel.getTradeManager().addTradeToFailedTrades(trade);
tradeManager.addTradeToFailedTrades(trade);
}
}
}

View File

@ -97,7 +97,7 @@ public class SetupDepositBalanceListener extends TradeTask {
trade.setState(Trade.State.DEPOSIT_SEEN_IN_NETWORK);
} else if (tradeState.getPhase() == Trade.Phase.PREPARATION) {
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);
}
}

View File

@ -69,7 +69,7 @@ public class MarketsStatisticsView extends ActivatableViewAndModel<GridPane, Mar
statisticsTableView.getColumns().add(getTotalAmountColumn());
statisticsTableView.getColumns().add(getSpreadColumn());
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);
statisticsTableView.setPlaceholder(placeholder);
}