handle stopTimer at end of tasks

This commit is contained in:
Manfred Karrer 2017-06-21 23:26:15 +02:00
parent 66ecf2c74a
commit a46cb5317e
7 changed files with 27 additions and 17 deletions

View File

@ -365,7 +365,7 @@ createOffer.useLowerValue=Yes, use my lower value
createOffer.priceOutSideOfDeviation=The price you have entered is outside the max. allowed deviation from the market price.\nThe max. allowed deviation is {0} and can be adjusted in the preferences.
createOffer.changePrice=Change price
createOffer.tac=With placing that offer I agree to trade with any trader who fulfills the conditions as defined above.
createOffer.currencyForFee=Currency for maker fee
createOffer.currencyForFee=Maker fee
createOffer.feeCurrencyAndDeposit=Set fee currency and security deposit

View File

@ -21,6 +21,7 @@ import com.google.inject.Inject;
import io.bisq.common.handlers.ExceptionHandler;
import io.bisq.common.handlers.ResultHandler;
import io.bisq.common.locale.Res;
import io.bisq.core.app.BisqEnvironment;
import io.bisq.core.crypto.ScryptUtil;
import org.bitcoinj.crypto.KeyCrypter;
import org.bitcoinj.crypto.KeyCrypterScrypt;
@ -68,10 +69,12 @@ public class WalletsManager {
}
public String getWalletsAsString(boolean includePrivKeys) {
return Res.getBaseCurrencyCode() + " Wallet:\n" +
btcWalletService.getWalletAsString(includePrivKeys) +
"\n\nBSQ Wallet:\n" +
bsqWalletService.getWalletAsString(includePrivKeys);
final String baseCurrencyWalletDetails = Res.getBaseCurrencyCode() + " Wallet:\n" +
btcWalletService.getWalletAsString(includePrivKeys);
final String bsqWalletDetails = BisqEnvironment.isBaseCurrencySupportingBsq() ?
"\n\nBSQ Wallet:\n" + bsqWalletService.getWalletAsString(includePrivKeys) :
"";
return baseCurrencyWalletDetails + bsqWalletDetails;
}
public void restoreSeedWords(@Nullable DeterministicSeed seed, ResultHandler resultHandler, ExceptionHandler exceptionHandler) {
@ -87,11 +90,11 @@ public class WalletsManager {
}
public boolean areWalletsEncrypted() {
return btcWalletService.isEncrypted() && bsqWalletService.isEncrypted();
return btcWalletService.isEncrypted() && (!BisqEnvironment.isBaseCurrencySupportingBsq() || bsqWalletService.isEncrypted());
}
public boolean areWalletsAvailable() {
return btcWalletService.isWalletReady() && bsqWalletService.isWalletReady();
return btcWalletService.isWalletReady() && (!BisqEnvironment.isBaseCurrencySupportingBsq() || bsqWalletService.isWalletReady());
}
public KeyCrypterScrypt getKeyCrypterScrypt() {

View File

@ -131,12 +131,14 @@ public class BuyerAsMakerProtocol extends TradeProtocol implements BuyerProtocol
///////////////////////////////////////////////////////////////////////////////////////////
private void handle(DepositTxPublishedMessage tradeMessage, NodeAddress peerNodeAddress) {
stopTimeout();
processModel.setTradeMessage(tradeMessage);
processModel.setTempTradingPeerNodeAddress(peerNodeAddress);
TradeTaskRunner taskRunner = new TradeTaskRunner(buyerAsMakerTrade,
() -> handleTaskRunnerSuccess("handle DepositTxPublishedMessage"),
() -> {
stopTimeout();
handleTaskRunnerSuccess("handle DepositTxPublishedMessage");
},
this::handleTaskRunnerFault);
taskRunner.addTasks(MakerProcessDepositTxPublishedMessage.class,
MakerVerifyTakerAccount.class,

View File

@ -112,12 +112,14 @@ public class BuyerAsTakerProtocol extends TradeProtocol implements BuyerProtocol
///////////////////////////////////////////////////////////////////////////////////////////
private void handle(PublishDepositTxRequest tradeMessage, NodeAddress sender) {
stopTimeout();
processModel.setTradeMessage(tradeMessage);
processModel.setTempTradingPeerNodeAddress(sender);
TradeTaskRunner taskRunner = new TradeTaskRunner(buyerAsTakerTrade,
() -> handleTaskRunnerSuccess("PublishDepositTxRequest"),
() -> {
stopTimeout();
handleTaskRunnerSuccess("PublishDepositTxRequest");
},
this::handleTaskRunnerFault);
taskRunner.addTasks(
TakerProcessPublishDepositTxRequest.class,

View File

@ -122,12 +122,14 @@ public class SellerAsMakerProtocol extends TradeProtocol implements SellerProtoc
///////////////////////////////////////////////////////////////////////////////////////////
private void handle(DepositTxPublishedMessage tradeMessage, NodeAddress sender) {
stopTimeout();
processModel.setTradeMessage(tradeMessage);
processModel.setTempTradingPeerNodeAddress(sender);
TradeTaskRunner taskRunner = new TradeTaskRunner(sellerAsMakerTrade,
() -> handleTaskRunnerSuccess("DepositTxPublishedMessage"),
() -> {
stopTimeout();
handleTaskRunnerSuccess("DepositTxPublishedMessage");
},
this::handleTaskRunnerFault);
taskRunner.addTasks(MakerProcessDepositTxPublishedMessage.class,

View File

@ -106,13 +106,14 @@ public class SellerAsTakerProtocol extends TradeProtocol implements SellerProtoc
///////////////////////////////////////////////////////////////////////////////////////////
private void handle(PublishDepositTxRequest tradeMessage, NodeAddress sender) {
log.debug("handle RequestPayDepositMessage");
stopTimeout();
processModel.setTradeMessage(tradeMessage);
processModel.setTempTradingPeerNodeAddress(sender);
TradeTaskRunner taskRunner = new TradeTaskRunner(sellerAsTakerTrade,
() -> handleTaskRunnerSuccess("PayDepositRequest"),
() -> {
stopTimeout();
handleTaskRunnerSuccess("PublishDepositTxRequest");
},
this::handleTaskRunnerFault);
taskRunner.addTasks(

View File

@ -110,7 +110,7 @@ public abstract class TradeProtocol {
stopTimeout();
timeoutTimer = UserThread.runAfter(() -> {
log.error("Timeout reached. TradeID=" + trade.getId());
log.error("Timeout reached. TradeID={}, state={}", trade.getId(), trade.stateProperty().get());
trade.setErrorMessage("A timeout occurred.");
cleanupTradableOnFault();
cleanup();