mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-11-16 15:58:08 +00:00
seller state is PAYMENT_RECEIVED or PAYOUT_PUBLISHED after confirming
This commit is contained in:
parent
730bee3e71
commit
2d3043093e
12 changed files with 95 additions and 68 deletions
|
@ -162,14 +162,14 @@ public class TakeBuyBTCOfferTest extends AbstractTradeTest {
|
|||
trade = aliceClient.getTrade(tradeId);
|
||||
|
||||
if (!trade.getIsPaymentSent()) {
|
||||
log.warn("Alice still waiting for trade {} BUYER_SAW_ARRIVED_PAYMENT_INITIATED_MSG, attempt # {}",
|
||||
log.warn("Alice still waiting for trade {} BUYER_SAW_ARRIVED_PAYMENT_SENT_MSG, attempt # {}",
|
||||
trade.getShortId(),
|
||||
i);
|
||||
sleep(5000);
|
||||
continue;
|
||||
} else {
|
||||
assertEquals(OFFER_FEE_PAID.name(), trade.getOffer().getState());
|
||||
EXPECTED_PROTOCOL_STATUS.setState(BUYER_SAW_ARRIVED_PAYMENT_INITIATED_MSG)
|
||||
EXPECTED_PROTOCOL_STATUS.setState(BUYER_SAW_ARRIVED_PAYMENT_SENT_MSG)
|
||||
.setPhase(PAYMENT_SENT)
|
||||
.setFiatSent(true);
|
||||
verifyExpectedProtocolStatus(trade);
|
||||
|
@ -189,7 +189,7 @@ public class TakeBuyBTCOfferTest extends AbstractTradeTest {
|
|||
var trade = bobClient.getTrade(tradeId);
|
||||
|
||||
Predicate<TradeInfo> tradeStateAndPhaseCorrect = (t) ->
|
||||
t.getState().equals(SELLER_RECEIVED_PAYMENT_INITIATED_MSG.name())
|
||||
t.getState().equals(SELLER_RECEIVED_PAYMENT_SENT_MSG.name())
|
||||
&& (t.getPhase().equals(PAYOUT_PUBLISHED.name()) || t.getPhase().equals(PAYMENT_SENT.name()));
|
||||
|
||||
for (int i = 1; i <= maxTradeStateAndPhaseChecks.get(); i++) {
|
||||
|
|
|
@ -164,7 +164,7 @@ public class TakeSellBTCOfferTest extends AbstractTradeTest {
|
|||
trade = bobClient.getTrade(tradeId);
|
||||
|
||||
if (!trade.getIsPaymentSent()) {
|
||||
log.warn("Bob still waiting for trade {} BUYER_SAW_ARRIVED_PAYMENT_INITIATED_MSG, attempt # {}",
|
||||
log.warn("Bob still waiting for trade {} BUYER_SAW_ARRIVED_PAYMENT_SENT_MSG, attempt # {}",
|
||||
trade.getShortId(),
|
||||
i);
|
||||
sleep(5000);
|
||||
|
@ -172,7 +172,7 @@ public class TakeSellBTCOfferTest extends AbstractTradeTest {
|
|||
} else {
|
||||
// Note: offer.state == available
|
||||
assertEquals(AVAILABLE.name(), trade.getOffer().getState());
|
||||
EXPECTED_PROTOCOL_STATUS.setState(BUYER_SAW_ARRIVED_PAYMENT_INITIATED_MSG)
|
||||
EXPECTED_PROTOCOL_STATUS.setState(BUYER_SAW_ARRIVED_PAYMENT_SENT_MSG)
|
||||
.setPhase(PAYMENT_SENT)
|
||||
.setFiatSent(true);
|
||||
verifyExpectedProtocolStatus(trade);
|
||||
|
@ -192,7 +192,7 @@ public class TakeSellBTCOfferTest extends AbstractTradeTest {
|
|||
var trade = aliceClient.getTrade(tradeId);
|
||||
|
||||
Predicate<TradeInfo> tradeStateAndPhaseCorrect = (t) ->
|
||||
t.getState().equals(SELLER_RECEIVED_PAYMENT_INITIATED_MSG.name())
|
||||
t.getState().equals(SELLER_RECEIVED_PAYMENT_SENT_MSG.name())
|
||||
&& (t.getPhase().equals(PAYOUT_PUBLISHED.name()) || t.getPhase().equals(PAYMENT_SENT.name()));
|
||||
for (int i = 1; i <= maxTradeStateAndPhaseChecks.get(); i++) {
|
||||
if (!tradeStateAndPhaseCorrect.test(trade)) {
|
||||
|
|
|
@ -154,21 +154,24 @@ public abstract class Trade implements Tradable, Model {
|
|||
|
||||
|
||||
// #################### Phase PAYMENT_SENT
|
||||
BUYER_CONFIRMED_IN_UI_PAYMENT_INITIATED(Phase.PAYMENT_SENT),
|
||||
BUYER_SENT_PAYMENT_INITIATED_MSG(Phase.PAYMENT_SENT),
|
||||
BUYER_SAW_ARRIVED_PAYMENT_INITIATED_MSG(Phase.PAYMENT_SENT),
|
||||
BUYER_STORED_IN_MAILBOX_PAYMENT_INITIATED_MSG(Phase.PAYMENT_SENT),
|
||||
BUYER_SEND_FAILED_PAYMENT_INITIATED_MSG(Phase.PAYMENT_SENT),
|
||||
BUYER_CONFIRMED_IN_UI_PAYMENT_SENT(Phase.PAYMENT_SENT),
|
||||
BUYER_SENT_PAYMENT_SENT_MSG(Phase.PAYMENT_SENT),
|
||||
BUYER_SAW_ARRIVED_PAYMENT_SENT_MSG(Phase.PAYMENT_SENT),
|
||||
BUYER_STORED_IN_MAILBOX_PAYMENT_SENT_MSG(Phase.PAYMENT_SENT),
|
||||
BUYER_SEND_FAILED_PAYMENT_SENT_MSG(Phase.PAYMENT_SENT),
|
||||
|
||||
SELLER_RECEIVED_PAYMENT_INITIATED_MSG(Phase.PAYMENT_SENT),
|
||||
SELLER_RECEIVED_PAYMENT_SENT_MSG(Phase.PAYMENT_SENT),
|
||||
|
||||
// #################### Phase PAYMENT_RECEIVED
|
||||
// note that this state can also be triggered by auto confirmation feature
|
||||
SELLER_CONFIRMED_IN_UI_PAYMENT_RECEIPT(Phase.PAYMENT_RECEIVED),
|
||||
SELLER_SENT_PAYMENT_RECEIVED_MSG(Phase.PAYMENT_RECEIVED),
|
||||
SELLER_SAW_ARRIVED_PAYMENT_RECEIVED_MSG(Phase.PAYMENT_RECEIVED),
|
||||
SELLER_STORED_IN_MAILBOX_PAYMENT_RECEIVED_MSG(Phase.PAYMENT_RECEIVED),
|
||||
SELLER_SEND_FAILED_PAYMENT_RECEIVED_MSG(Phase.PAYMENT_RECEIVED),
|
||||
|
||||
// #################### Phase PAYOUT_PUBLISHED
|
||||
SELLER_PUBLISHED_PAYOUT_TX(Phase.PAYOUT_PUBLISHED), // TODO (woodser): this enum is over used, like during arbitration
|
||||
|
||||
SELLER_SENT_PAYOUT_TX_PUBLISHED_MSG(Phase.PAYOUT_PUBLISHED),
|
||||
SELLER_SAW_ARRIVED_PAYOUT_TX_PUBLISHED_MSG(Phase.PAYOUT_PUBLISHED),
|
||||
SELLER_STORED_IN_MAILBOX_PAYOUT_TX_PUBLISHED_MSG(Phase.PAYOUT_PUBLISHED),
|
||||
|
@ -850,10 +853,10 @@ public abstract class Trade implements Tradable, Model {
|
|||
walletService.closeMultisigWallet(getId());
|
||||
|
||||
// update trade state
|
||||
this.getSelf().setPayoutTxHex(signedPayoutTxHex);
|
||||
this.setPayoutTx(parsedTxSet.getTxs().get(0));
|
||||
this.setPayoutTxId(parsedTxSet.getTxs().get(0).getHash());
|
||||
this.setState(Trade.State.SELLER_PUBLISHED_PAYOUT_TX);
|
||||
getSelf().setPayoutTxHex(signedPayoutTxHex);
|
||||
setPayoutTx(parsedTxSet.getTxs().get(0));
|
||||
setPayoutTxId(parsedTxSet.getTxs().get(0).getHash());
|
||||
setState(isBuyer() ? Trade.State.BUYER_PUBLISHED_PAYOUT_TX : Trade.State.SELLER_PUBLISHED_PAYOUT_TX);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1116,26 +1119,42 @@ public abstract class Trade implements Tradable, Model {
|
|||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Getter
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
public boolean isBuyer() {
|
||||
return offer.getDirection() == Direction.BUY;
|
||||
}
|
||||
|
||||
public boolean isSeller() {
|
||||
return offer.getDirection() == Direction.SELL;
|
||||
}
|
||||
|
||||
public boolean isMaker() {
|
||||
return this instanceof MakerTrade;
|
||||
}
|
||||
|
||||
public boolean isTaker() {
|
||||
return this instanceof TakerTrade;
|
||||
}
|
||||
|
||||
public TradingPeer getSelf() {
|
||||
if (this instanceof MakerTrade) return processModel.getMaker();
|
||||
if (this instanceof TakerTrade) return processModel.getTaker();
|
||||
if (this instanceof ArbitratorTrade) return processModel.getArbitrator();
|
||||
throw new RuntimeException("Trade is not maker, taker, or arbitrator");
|
||||
}
|
||||
|
||||
|
||||
public TradingPeer getMaker() {
|
||||
return processModel.getMaker();
|
||||
}
|
||||
|
||||
|
||||
public TradingPeer getTaker() {
|
||||
return processModel.getTaker();
|
||||
}
|
||||
|
||||
|
||||
public TradingPeer getBuyer() {
|
||||
return offer.getDirection() == Direction.BUY ? processModel.getMaker() : processModel.getTaker();
|
||||
}
|
||||
|
||||
|
||||
public TradingPeer getSeller() {
|
||||
return offer.getDirection() == Direction.BUY ? processModel.getTaker() : processModel.getMaker();
|
||||
}
|
||||
|
|
|
@ -69,8 +69,8 @@ public abstract class BuyerProtocol extends DisputeProtocol {
|
|||
.executeTasks();
|
||||
|
||||
given(anyPhase(Trade.Phase.PAYMENT_SENT, Trade.Phase.PAYMENT_RECEIVED)
|
||||
.anyState(Trade.State.BUYER_STORED_IN_MAILBOX_PAYMENT_INITIATED_MSG,
|
||||
Trade.State.BUYER_SEND_FAILED_PAYMENT_INITIATED_MSG)
|
||||
.anyState(Trade.State.BUYER_STORED_IN_MAILBOX_PAYMENT_SENT_MSG,
|
||||
Trade.State.BUYER_SEND_FAILED_PAYMENT_SENT_MSG)
|
||||
.with(BuyerEvent.STARTUP))
|
||||
.setup(tasks(BuyerSendsPaymentSentMessage.class))
|
||||
.executeTasks();
|
||||
|
@ -151,7 +151,7 @@ public abstract class BuyerProtocol extends DisputeProtocol {
|
|||
errorMessageHandler.handleErrorMessage(errorMessage);
|
||||
handleTaskRunnerFault(event, errorMessage);
|
||||
})))
|
||||
.run(() -> trade.setState(Trade.State.BUYER_CONFIRMED_IN_UI_PAYMENT_INITIATED))
|
||||
.run(() -> trade.setState(Trade.State.BUYER_CONFIRMED_IN_UI_PAYMENT_SENT))
|
||||
.executeTasks();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ public abstract class SellerProtocol extends DisputeProtocol {
|
|||
synchronized (trade) {
|
||||
SellerEvent event = SellerEvent.PAYMENT_RECEIVED;
|
||||
// CountDownLatch latch = new CountDownLatch(1); // TODO (woodser): user countdown latch, but freezes legacy app
|
||||
expect(anyPhase(Trade.Phase.PAYMENT_SENT, Trade.Phase.PAYOUT_PUBLISHED)
|
||||
expect(anyPhase(Trade.Phase.PAYMENT_SENT)
|
||||
.with(event)
|
||||
.preCondition(trade.confirmPermitted()))
|
||||
.setup(tasks(
|
||||
|
|
|
@ -89,8 +89,8 @@ public class BuyerSendsPaymentSentMessage extends SendMailboxMessageTask {
|
|||
|
||||
@Override
|
||||
protected void setStateSent() {
|
||||
if (trade.getState().ordinal() < Trade.State.BUYER_SENT_PAYMENT_INITIATED_MSG.ordinal()) {
|
||||
trade.setStateIfValidTransitionTo(Trade.State.BUYER_SENT_PAYMENT_INITIATED_MSG);
|
||||
if (trade.getState().ordinal() < Trade.State.BUYER_SENT_PAYMENT_SENT_MSG.ordinal()) {
|
||||
trade.setStateIfValidTransitionTo(Trade.State.BUYER_SENT_PAYMENT_SENT_MSG);
|
||||
}
|
||||
|
||||
processModel.getTradeManager().requestPersistence();
|
||||
|
@ -112,7 +112,7 @@ public class BuyerSendsPaymentSentMessage extends SendMailboxMessageTask {
|
|||
|
||||
@Override
|
||||
protected void setStateStoredInMailbox() {
|
||||
trade.setStateIfValidTransitionTo(Trade.State.BUYER_STORED_IN_MAILBOX_PAYMENT_INITIATED_MSG);
|
||||
trade.setStateIfValidTransitionTo(Trade.State.BUYER_STORED_IN_MAILBOX_PAYMENT_SENT_MSG);
|
||||
if (!trade.isPayoutPublished()) {
|
||||
tryToSendAgainLater();
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ public class BuyerSendsPaymentSentMessage extends SendMailboxMessageTask {
|
|||
|
||||
@Override
|
||||
protected void setStateFault() {
|
||||
trade.setStateIfValidTransitionTo(Trade.State.BUYER_SEND_FAILED_PAYMENT_INITIATED_MSG);
|
||||
trade.setStateIfValidTransitionTo(Trade.State.BUYER_SEND_FAILED_PAYMENT_SENT_MSG);
|
||||
if (!trade.isPayoutPublished()) {
|
||||
tryToSendAgainLater();
|
||||
}
|
||||
|
@ -192,8 +192,8 @@ public class BuyerSendsPaymentSentMessage extends SendMailboxMessageTask {
|
|||
private void onMessageStateChange(MessageState newValue) {
|
||||
// Once we receive an ACK from our msg we know the peer has received the msg and we stop.
|
||||
if (newValue == MessageState.ACKNOWLEDGED) {
|
||||
// We treat a ACK like BUYER_SAW_ARRIVED_PAYMENT_INITIATED_MSG
|
||||
trade.setStateIfValidTransitionTo(Trade.State.BUYER_SAW_ARRIVED_PAYMENT_INITIATED_MSG);
|
||||
// We treat a ACK like BUYER_SAW_ARRIVED_PAYMENT_SENT_MSG
|
||||
trade.setStateIfValidTransitionTo(Trade.State.BUYER_SAW_ARRIVED_PAYMENT_SENT_MSG);
|
||||
|
||||
processModel.getTradeManager().requestPersistence();
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ public class SellerProcessesPaymentSentMessage extends TradeTask {
|
|||
trade.setCounterCurrencyExtraData(counterCurrencyExtraData);
|
||||
}
|
||||
|
||||
trade.setState(Trade.State.SELLER_RECEIVED_PAYMENT_INITIATED_MSG);
|
||||
trade.setState(Trade.State.SELLER_RECEIVED_PAYMENT_SENT_MSG);
|
||||
|
||||
processModel.getTradeManager().requestPersistence();
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ public class SellerSendsPaymentReceivedMessage extends SendMailboxMessageTask {
|
|||
|
||||
@Override
|
||||
protected void setStateSent() {
|
||||
trade.setState(Trade.State.SELLER_SENT_PAYOUT_TX_PUBLISHED_MSG);
|
||||
trade.setState(trade.getState() == Trade.State.SELLER_PUBLISHED_PAYOUT_TX ? Trade.State.SELLER_SENT_PAYOUT_TX_PUBLISHED_MSG : Trade.State.SELLER_SENT_PAYMENT_RECEIVED_MSG);
|
||||
log.info("Sent SellerReceivedPaymentMessage: tradeId={} at peer {} SignedWitness {}",
|
||||
trade.getId(), trade.getTradingPeerNodeAddress(), signedWitness);
|
||||
processModel.getTradeManager().requestPersistence();
|
||||
|
@ -85,7 +85,7 @@ public class SellerSendsPaymentReceivedMessage extends SendMailboxMessageTask {
|
|||
|
||||
@Override
|
||||
protected void setStateArrived() {
|
||||
trade.setState(Trade.State.SELLER_SAW_ARRIVED_PAYOUT_TX_PUBLISHED_MSG);
|
||||
trade.setState(trade.getState() == Trade.State.SELLER_PUBLISHED_PAYOUT_TX ? Trade.State.SELLER_SAW_ARRIVED_PAYOUT_TX_PUBLISHED_MSG : Trade.State.SELLER_SAW_ARRIVED_PAYMENT_RECEIVED_MSG);
|
||||
log.info("SellerReceivedPaymentMessage arrived: tradeId={} at peer {} SignedWitness {}",
|
||||
trade.getId(), trade.getTradingPeerNodeAddress(), signedWitness);
|
||||
processModel.getTradeManager().requestPersistence();
|
||||
|
@ -93,7 +93,7 @@ public class SellerSendsPaymentReceivedMessage extends SendMailboxMessageTask {
|
|||
|
||||
@Override
|
||||
protected void setStateStoredInMailbox() {
|
||||
trade.setState(Trade.State.SELLER_STORED_IN_MAILBOX_PAYOUT_TX_PUBLISHED_MSG);
|
||||
trade.setState(trade.getState() == Trade.State.SELLER_PUBLISHED_PAYOUT_TX ? Trade.State.SELLER_STORED_IN_MAILBOX_PAYOUT_TX_PUBLISHED_MSG : Trade.State.SELLER_STORED_IN_MAILBOX_PAYMENT_RECEIVED_MSG);
|
||||
log.info("SellerReceivedPaymentMessage storedInMailbox: tradeId={} at peer {} SignedWitness {}",
|
||||
trade.getId(), trade.getTradingPeerNodeAddress(), signedWitness);
|
||||
processModel.getTradeManager().requestPersistence();
|
||||
|
@ -101,7 +101,7 @@ public class SellerSendsPaymentReceivedMessage extends SendMailboxMessageTask {
|
|||
|
||||
@Override
|
||||
protected void setStateFault() {
|
||||
trade.setState(Trade.State.SELLER_SEND_FAILED_PAYOUT_TX_PUBLISHED_MSG);
|
||||
trade.setState(trade.getState() == Trade.State.SELLER_PUBLISHED_PAYOUT_TX ? Trade.State.SELLER_SEND_FAILED_PAYOUT_TX_PUBLISHED_MSG : Trade.State.SELLER_SEND_FAILED_PAYMENT_RECEIVED_MSG);
|
||||
log.error("SellerReceivedPaymentMessage failed: tradeId={} at peer {} SignedWitness {}",
|
||||
trade.getId(), trade.getTradingPeerNodeAddress(), signedWitness);
|
||||
processModel.getTradeManager().requestPersistence();
|
||||
|
|
|
@ -207,7 +207,7 @@ public class XmrTxProofService implements AssetTxProofService {
|
|||
if (isExpectedTradeState(trade.getState())) {
|
||||
startRequestsIfValid(trade);
|
||||
} else {
|
||||
// We are expecting SELLER_RECEIVED_PAYMENT_INITIATED_MSG in the future, so listen on changes
|
||||
// We are expecting SELLER_RECEIVED_PAYMENT_SENT_MSG in the future, so listen on changes
|
||||
ChangeListener<Trade.State> tradeStateListener = (observable, oldValue, newValue) -> {
|
||||
if (isExpectedTradeState(newValue)) {
|
||||
ChangeListener<Trade.State> listener = tradeStateListenerMap.remove(trade.getId());
|
||||
|
@ -346,7 +346,7 @@ public class XmrTxProofService implements AssetTxProofService {
|
|||
}
|
||||
|
||||
private boolean isExpectedTradeState(Trade.State newValue) {
|
||||
return newValue == Trade.State.SELLER_RECEIVED_PAYMENT_INITIATED_MSG;
|
||||
return newValue == Trade.State.SELLER_RECEIVED_PAYMENT_SENT_MSG;
|
||||
}
|
||||
|
||||
private boolean is32BitHexStringInValid(String hexString) {
|
||||
|
|
|
@ -452,31 +452,35 @@ public class PendingTradesViewModel extends ActivatableWithDataModel<PendingTrad
|
|||
break;
|
||||
|
||||
// buyer step 3
|
||||
case BUYER_CONFIRMED_IN_UI_PAYMENT_INITIATED: // UI action
|
||||
case BUYER_SENT_PAYMENT_INITIATED_MSG: // PAYMENT_INITIATED_MSG sent
|
||||
case BUYER_CONFIRMED_IN_UI_PAYMENT_SENT: // UI action
|
||||
case BUYER_SENT_PAYMENT_SENT_MSG: // PAYMENT_SENT_MSG sent
|
||||
// We don't switch the UI before we got the feedback of the msg delivery
|
||||
buyerState.set(BuyerState.STEP2);
|
||||
break;
|
||||
case BUYER_SAW_ARRIVED_PAYMENT_INITIATED_MSG: // PAYMENT_INITIATED_MSG arrived
|
||||
case BUYER_STORED_IN_MAILBOX_PAYMENT_INITIATED_MSG: // PAYMENT_INITIATED_MSG in mailbox
|
||||
case BUYER_SAW_ARRIVED_PAYMENT_SENT_MSG: // PAYMENT_SENT_MSG arrived
|
||||
case BUYER_STORED_IN_MAILBOX_PAYMENT_SENT_MSG: // PAYMENT_SENT_MSG in mailbox
|
||||
buyerState.set(BuyerState.STEP3);
|
||||
break;
|
||||
case BUYER_SEND_FAILED_PAYMENT_INITIATED_MSG: // PAYMENT_INITIATED_MSG failed
|
||||
case BUYER_SEND_FAILED_PAYMENT_SENT_MSG: // PAYMENT_SENT_MSG failed
|
||||
// if failed we need to repeat sending so back to step 2
|
||||
buyerState.set(BuyerState.STEP2);
|
||||
break;
|
||||
|
||||
// seller step 3
|
||||
case SELLER_RECEIVED_PAYMENT_INITIATED_MSG: // PAYMENT_INITIATED_MSG received
|
||||
case SELLER_RECEIVED_PAYMENT_SENT_MSG: // PAYMENT_SENT_MSG received
|
||||
sellerState.set(SellerState.STEP3);
|
||||
break;
|
||||
|
||||
// seller step 4
|
||||
case SELLER_CONFIRMED_IN_UI_PAYMENT_RECEIPT: // UI action
|
||||
case SELLER_PUBLISHED_PAYOUT_TX: // payout tx broad casted
|
||||
case SELLER_CONFIRMED_IN_UI_PAYMENT_RECEIPT: // UI action
|
||||
case SELLER_SENT_PAYMENT_RECEIVED_MSG:
|
||||
case SELLER_PUBLISHED_PAYOUT_TX: // payout tx broadcasted
|
||||
case SELLER_SENT_PAYOUT_TX_PUBLISHED_MSG: // PAYOUT_TX_PUBLISHED_MSG sent
|
||||
sellerState.set(SellerState.STEP3);
|
||||
break;
|
||||
case SELLER_SAW_ARRIVED_PAYMENT_RECEIVED_MSG:
|
||||
case SELLER_STORED_IN_MAILBOX_PAYMENT_RECEIVED_MSG:
|
||||
case SELLER_SEND_FAILED_PAYMENT_RECEIVED_MSG:
|
||||
case SELLER_SAW_ARRIVED_PAYOUT_TX_PUBLISHED_MSG: // PAYOUT_TX_PUBLISHED_MSG arrived
|
||||
case SELLER_STORED_IN_MAILBOX_PAYOUT_TX_PUBLISHED_MSG: // PAYOUT_TX_PUBLISHED_MSG mailbox
|
||||
case SELLER_SEND_FAILED_PAYOUT_TX_PUBLISHED_MSG: // PAYOUT_TX_PUBLISHED_MSG failed - payout tx is published, peer will see it in network so we ignore failure and complete
|
||||
|
|
|
@ -135,12 +135,12 @@ public class BuyerStep2View extends TradeStepView {
|
|||
|
||||
if (trade.isDepositConfirmed() && !trade.isPaymentSent()) {
|
||||
showPopup();
|
||||
} else if (state.ordinal() <= Trade.State.BUYER_SEND_FAILED_PAYMENT_INITIATED_MSG.ordinal()) {
|
||||
} else if (state.ordinal() <= Trade.State.BUYER_SEND_FAILED_PAYMENT_SENT_MSG.ordinal()) {
|
||||
if (!trade.hasFailed()) {
|
||||
UserThread.execute(() -> {
|
||||
switch (state) {
|
||||
case BUYER_CONFIRMED_IN_UI_PAYMENT_INITIATED:
|
||||
case BUYER_SENT_PAYMENT_INITIATED_MSG:
|
||||
case BUYER_CONFIRMED_IN_UI_PAYMENT_SENT:
|
||||
case BUYER_SENT_PAYMENT_SENT_MSG:
|
||||
busyAnimation.play();
|
||||
statusLabel.setText(Res.get("shared.sendingConfirmation"));
|
||||
model.setMessageStateProperty(MessageState.SENT);
|
||||
|
@ -149,17 +149,17 @@ public class BuyerStep2View extends TradeStepView {
|
|||
statusLabel.setText(Res.get("shared.sendingConfirmationAgain"));
|
||||
}, 10);
|
||||
break;
|
||||
case BUYER_SAW_ARRIVED_PAYMENT_INITIATED_MSG:
|
||||
case BUYER_SAW_ARRIVED_PAYMENT_SENT_MSG:
|
||||
busyAnimation.stop();
|
||||
statusLabel.setText(Res.get("shared.messageArrived"));
|
||||
model.setMessageStateProperty(MessageState.ARRIVED);
|
||||
break;
|
||||
case BUYER_STORED_IN_MAILBOX_PAYMENT_INITIATED_MSG:
|
||||
case BUYER_STORED_IN_MAILBOX_PAYMENT_SENT_MSG:
|
||||
busyAnimation.stop();
|
||||
statusLabel.setText(Res.get("shared.messageStoredInMailbox"));
|
||||
model.setMessageStateProperty(MessageState.STORED_IN_MAILBOX);
|
||||
break;
|
||||
case BUYER_SEND_FAILED_PAYMENT_INITIATED_MSG:
|
||||
case BUYER_SEND_FAILED_PAYMENT_SENT_MSG:
|
||||
// We get a popup and the trade closed, so we dont need to show anything here
|
||||
busyAnimation.stop();
|
||||
statusLabel.setText("");
|
||||
|
|
|
@ -1524,22 +1524,26 @@ message Trade {
|
|||
MAKER_RECEIVED_DEPOSIT_TX_PUBLISHED_MSG = 16;
|
||||
MAKER_SAW_DEPOSIT_TX_IN_NETWORK = 17;
|
||||
DEPOSIT_UNLOCKED_IN_BLOCK_CHAIN = 18;
|
||||
BUYER_CONFIRMED_IN_UI_PAYMENT_INITIATED = 19;
|
||||
BUYER_SENT_PAYMENT_INITIATED_MSG = 20;
|
||||
BUYER_SAW_ARRIVED_PAYMENT_INITIATED_MSG = 21;
|
||||
BUYER_STORED_IN_MAILBOX_PAYMENT_INITIATED_MSG = 22;
|
||||
BUYER_SEND_FAILED_PAYMENT_INITIATED_MSG = 23;
|
||||
SELLER_RECEIVED_PAYMENT_INITIATED_MSG = 24;
|
||||
BUYER_CONFIRMED_IN_UI_PAYMENT_SENT = 19;
|
||||
BUYER_SENT_PAYMENT_SENT_MSG = 20;
|
||||
BUYER_SAW_ARRIVED_PAYMENT_SENT_MSG = 21;
|
||||
BUYER_STORED_IN_MAILBOX_PAYMENT_SENT_MSG = 22;
|
||||
BUYER_SEND_FAILED_PAYMENT_SENT_MSG = 23;
|
||||
SELLER_RECEIVED_PAYMENT_SENT_MSG = 24;
|
||||
SELLER_CONFIRMED_IN_UI_PAYMENT_RECEIPT = 25;
|
||||
SELLER_PUBLISHED_PAYOUT_TX = 26;
|
||||
SELLER_SENT_PAYOUT_TX_PUBLISHED_MSG = 27;
|
||||
SELLER_SAW_ARRIVED_PAYOUT_TX_PUBLISHED_MSG = 28;
|
||||
SELLER_STORED_IN_MAILBOX_PAYOUT_TX_PUBLISHED_MSG = 29;
|
||||
SELLER_SEND_FAILED_PAYOUT_TX_PUBLISHED_MSG = 30;
|
||||
BUYER_RECEIVED_PAYOUT_TX_PUBLISHED_MSG = 31;
|
||||
BUYER_SAW_PAYOUT_TX_IN_NETWORK = 32;
|
||||
BUYER_PUBLISHED_PAYOUT_TX = 33;
|
||||
WITHDRAW_COMPLETED = 34;
|
||||
SELLER_SENT_PAYMENT_RECEIVED_MSG = 26;
|
||||
SELLER_SAW_ARRIVED_PAYMENT_RECEIVED_MSG = 27;
|
||||
SELLER_STORED_IN_MAILBOX_PAYMENT_RECEIVED_MSG = 28;
|
||||
SELLER_SEND_FAILED_PAYMENT_RECEIVED_MSG = 29;
|
||||
SELLER_PUBLISHED_PAYOUT_TX = 30;
|
||||
SELLER_SENT_PAYOUT_TX_PUBLISHED_MSG = 31;
|
||||
SELLER_SAW_ARRIVED_PAYOUT_TX_PUBLISHED_MSG = 32;
|
||||
SELLER_STORED_IN_MAILBOX_PAYOUT_TX_PUBLISHED_MSG = 33;
|
||||
SELLER_SEND_FAILED_PAYOUT_TX_PUBLISHED_MSG = 34;
|
||||
BUYER_RECEIVED_PAYOUT_TX_PUBLISHED_MSG = 35;
|
||||
BUYER_SAW_PAYOUT_TX_IN_NETWORK = 36;
|
||||
BUYER_PUBLISHED_PAYOUT_TX = 37;
|
||||
WITHDRAW_COMPLETED = 38;
|
||||
}
|
||||
|
||||
enum Phase {
|
||||
|
|
Loading…
Reference in a new issue