mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-07-28 17:34:11 -04:00
Resend confirmation at startup if peer has not continued trade process
This commit is contained in:
parent
ee4119b2e6
commit
df7f0e7917
7 changed files with 124 additions and 63 deletions
|
@ -55,6 +55,15 @@ public abstract class BuyerTrade extends Trade {
|
||||||
((BuyerProtocol) tradeProtocol).onFiatPaymentStarted(resultHandler, errorMessageHandler);
|
((BuyerProtocol) tradeProtocol).onFiatPaymentStarted(resultHandler, errorMessageHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reSendConfirmation() {
|
||||||
|
if (state == Trade.State.BUYER_SENT_FIAT_PAYMENT_INITIATED_MSG) {
|
||||||
|
log.info("reSendConfirmation onFiatPaymentStarted");
|
||||||
|
onFiatPaymentStarted(() -> log.debug("onFiatPaymentStarted succeeded"),
|
||||||
|
log::warn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Setter for Mutable objects
|
// Setter for Mutable objects
|
||||||
|
|
|
@ -55,6 +55,14 @@ public abstract class SellerTrade extends Trade {
|
||||||
((SellerProtocol) tradeProtocol).onFiatPaymentReceived(resultHandler, errorMessageHandler);
|
((SellerProtocol) tradeProtocol).onFiatPaymentReceived(resultHandler, errorMessageHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reSendConfirmation() {
|
||||||
|
if (state == State.SELLER_SENT_FIAT_PAYMENT_RECEIPT_MSG) {
|
||||||
|
log.info("reSendConfirmation onFiatPaymentReceived");
|
||||||
|
onFiatPaymentReceived(() -> log.debug("onFiatPaymentReceived succeeded"),
|
||||||
|
log::warn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Setter for Mutable objects
|
// Setter for Mutable objects
|
||||||
|
|
|
@ -238,8 +238,12 @@ public abstract class Trade implements Tradable, Model {
|
||||||
if (decryptedMsgWithPubKey != null) {
|
if (decryptedMsgWithPubKey != null) {
|
||||||
tradeProtocol.applyMailboxMessage(decryptedMsgWithPubKey, this);
|
tradeProtocol.applyMailboxMessage(decryptedMsgWithPubKey, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reSendConfirmation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract void reSendConfirmation();
|
||||||
|
|
||||||
protected void initStateProperties() {
|
protected void initStateProperties() {
|
||||||
stateProperty = new SimpleObjectProperty<>(state);
|
stateProperty = new SimpleObjectProperty<>(state);
|
||||||
disputeStateProperty = new SimpleObjectProperty<>(disputeState);
|
disputeStateProperty = new SimpleObjectProperty<>(disputeState);
|
||||||
|
|
|
@ -144,6 +144,11 @@ public class BuyerAsOffererProtocol extends TradeProtocol implements BuyerProtoc
|
||||||
// User clicked the "bank transfer started" button
|
// User clicked the "bank transfer started" button
|
||||||
@Override
|
@Override
|
||||||
public void onFiatPaymentStarted(ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) {
|
public void onFiatPaymentStarted(ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) {
|
||||||
|
if (buyerAsOffererTrade.getState().ordinal() <= Trade.State.BUYER_SENT_FIAT_PAYMENT_INITIATED_MSG.ordinal()) {
|
||||||
|
if (buyerAsOffererTrade.getState() == Trade.State.BUYER_SENT_FIAT_PAYMENT_INITIATED_MSG)
|
||||||
|
log.warn("onFiatPaymentStarted called twice. " +
|
||||||
|
"That is expected if the app starts up and the other peer has still not continued.");
|
||||||
|
|
||||||
buyerAsOffererTrade.setState(Trade.State.BUYER_CONFIRMED_FIAT_PAYMENT_INITIATED);
|
buyerAsOffererTrade.setState(Trade.State.BUYER_CONFIRMED_FIAT_PAYMENT_INITIATED);
|
||||||
|
|
||||||
TradeTaskRunner taskRunner = new TradeTaskRunner(buyerAsOffererTrade,
|
TradeTaskRunner taskRunner = new TradeTaskRunner(buyerAsOffererTrade,
|
||||||
|
@ -160,6 +165,11 @@ public class BuyerAsOffererProtocol extends TradeProtocol implements BuyerProtoc
|
||||||
SendFiatTransferStartedMessage.class
|
SendFiatTransferStartedMessage.class
|
||||||
);
|
);
|
||||||
taskRunner.run();
|
taskRunner.run();
|
||||||
|
} else {
|
||||||
|
log.warn("onFiatPaymentStarted called twice. " +
|
||||||
|
"That should not happen.\n" +
|
||||||
|
"state=" + buyerAsOffererTrade.getState());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -133,6 +133,11 @@ public class BuyerAsTakerProtocol extends TradeProtocol implements BuyerProtocol
|
||||||
// User clicked the "bank transfer started" button
|
// User clicked the "bank transfer started" button
|
||||||
@Override
|
@Override
|
||||||
public void onFiatPaymentStarted(ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) {
|
public void onFiatPaymentStarted(ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) {
|
||||||
|
if (buyerAsTakerTrade.getState().ordinal() <= Trade.State.BUYER_SENT_FIAT_PAYMENT_INITIATED_MSG.ordinal()) {
|
||||||
|
if (buyerAsTakerTrade.getState() == Trade.State.BUYER_SENT_FIAT_PAYMENT_INITIATED_MSG)
|
||||||
|
log.warn("onFiatPaymentStarted called twice. " +
|
||||||
|
"That is expected if the app starts up and the other peer has still not continued.");
|
||||||
|
|
||||||
buyerAsTakerTrade.setState(Trade.State.BUYER_CONFIRMED_FIAT_PAYMENT_INITIATED);
|
buyerAsTakerTrade.setState(Trade.State.BUYER_CONFIRMED_FIAT_PAYMENT_INITIATED);
|
||||||
|
|
||||||
TradeTaskRunner taskRunner = new TradeTaskRunner(buyerAsTakerTrade,
|
TradeTaskRunner taskRunner = new TradeTaskRunner(buyerAsTakerTrade,
|
||||||
|
@ -149,6 +154,11 @@ public class BuyerAsTakerProtocol extends TradeProtocol implements BuyerProtocol
|
||||||
SendFiatTransferStartedMessage.class
|
SendFiatTransferStartedMessage.class
|
||||||
);
|
);
|
||||||
taskRunner.run();
|
taskRunner.run();
|
||||||
|
} else {
|
||||||
|
log.warn("onFiatPaymentStarted called twice. " +
|
||||||
|
"That should not happen.\n" +
|
||||||
|
"state=" + buyerAsTakerTrade.getState());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -162,6 +162,11 @@ public class SellerAsOffererProtocol extends TradeProtocol implements SellerProt
|
||||||
// User clicked the "bank transfer received" button, so we release the funds for pay out
|
// User clicked the "bank transfer received" button, so we release the funds for pay out
|
||||||
@Override
|
@Override
|
||||||
public void onFiatPaymentReceived(ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) {
|
public void onFiatPaymentReceived(ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) {
|
||||||
|
if (sellerAsOffererTrade.getState().ordinal() <= Trade.State.SELLER_SENT_FIAT_PAYMENT_RECEIPT_MSG.ordinal()) {
|
||||||
|
if (sellerAsOffererTrade.getState() == Trade.State.SELLER_SENT_FIAT_PAYMENT_RECEIPT_MSG)
|
||||||
|
log.warn("onFiatPaymentReceived called twice. " +
|
||||||
|
"That is expected if the app starts up and the other peer has still not continued.");
|
||||||
|
|
||||||
sellerAsOffererTrade.setState(Trade.State.SELLER_CONFIRMED_FIAT_PAYMENT_RECEIPT);
|
sellerAsOffererTrade.setState(Trade.State.SELLER_CONFIRMED_FIAT_PAYMENT_RECEIPT);
|
||||||
|
|
||||||
TradeTaskRunner taskRunner = new TradeTaskRunner(sellerAsOffererTrade,
|
TradeTaskRunner taskRunner = new TradeTaskRunner(sellerAsOffererTrade,
|
||||||
|
@ -180,6 +185,11 @@ public class SellerAsOffererProtocol extends TradeProtocol implements SellerProt
|
||||||
SendFinalizePayoutTxRequest.class
|
SendFinalizePayoutTxRequest.class
|
||||||
);
|
);
|
||||||
taskRunner.run();
|
taskRunner.run();
|
||||||
|
} else {
|
||||||
|
log.warn("onFiatPaymentReceived called twice. " +
|
||||||
|
"That should not happen.\n" +
|
||||||
|
"state=" + sellerAsOffererTrade.getState());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handle(PayoutTxFinalizedMessage tradeMessage, NodeAddress sender) {
|
private void handle(PayoutTxFinalizedMessage tradeMessage, NodeAddress sender) {
|
||||||
|
|
|
@ -160,6 +160,11 @@ public class SellerAsTakerProtocol extends TradeProtocol implements SellerProtoc
|
||||||
// User clicked the "bank transfer received" button, so we release the funds for pay out
|
// User clicked the "bank transfer received" button, so we release the funds for pay out
|
||||||
@Override
|
@Override
|
||||||
public void onFiatPaymentReceived(ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) {
|
public void onFiatPaymentReceived(ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) {
|
||||||
|
if (sellerAsTakerTrade.getState().ordinal() <= Trade.State.SELLER_SENT_FIAT_PAYMENT_RECEIPT_MSG.ordinal()) {
|
||||||
|
if (sellerAsTakerTrade.getState() == Trade.State.SELLER_SENT_FIAT_PAYMENT_RECEIPT_MSG)
|
||||||
|
log.warn("onFiatPaymentReceived called twice. " +
|
||||||
|
"That is expected if the app starts up and the other peer has still not continued.");
|
||||||
|
|
||||||
sellerAsTakerTrade.setState(Trade.State.SELLER_CONFIRMED_FIAT_PAYMENT_RECEIPT);
|
sellerAsTakerTrade.setState(Trade.State.SELLER_CONFIRMED_FIAT_PAYMENT_RECEIPT);
|
||||||
|
|
||||||
TradeTaskRunner taskRunner = new TradeTaskRunner(sellerAsTakerTrade,
|
TradeTaskRunner taskRunner = new TradeTaskRunner(sellerAsTakerTrade,
|
||||||
|
@ -178,6 +183,11 @@ public class SellerAsTakerProtocol extends TradeProtocol implements SellerProtoc
|
||||||
SendFinalizePayoutTxRequest.class
|
SendFinalizePayoutTxRequest.class
|
||||||
);
|
);
|
||||||
taskRunner.run();
|
taskRunner.run();
|
||||||
|
} else {
|
||||||
|
log.warn("onFiatPaymentReceived called twice. " +
|
||||||
|
"That should not happen.\n" +
|
||||||
|
"state=" + sellerAsTakerTrade.getState());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handle(PayoutTxFinalizedMessage tradeMessage, NodeAddress sender) {
|
private void handle(PayoutTxFinalizedMessage tradeMessage, NodeAddress sender) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue