mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 01:41:11 +01:00
Merge pull request #5746 from jmacxx/missing_invalid_transaction_diagnostic
Fix issue of Trade Step 1 validation done too soon
This commit is contained in:
commit
9ad4671773
@ -119,10 +119,10 @@ public abstract class Trade implements Tradable, Model {
|
||||
|
||||
// DEPOSIT_TX_PUBLISHED_MSG
|
||||
// seller perspective
|
||||
SELLER_SENT_DEPOSIT_TX_PUBLISHED_MSG(Phase.DEPOSIT_PUBLISHED),
|
||||
SELLER_SAW_ARRIVED_DEPOSIT_TX_PUBLISHED_MSG(Phase.DEPOSIT_PUBLISHED),
|
||||
SELLER_STORED_IN_MAILBOX_DEPOSIT_TX_PUBLISHED_MSG(Phase.DEPOSIT_PUBLISHED),
|
||||
SELLER_SEND_FAILED_DEPOSIT_TX_PUBLISHED_MSG(Phase.DEPOSIT_PUBLISHED),
|
||||
@Deprecated SELLER_SENT_DEPOSIT_TX_PUBLISHED_MSG(Phase.DEPOSIT_PUBLISHED),
|
||||
@Deprecated SELLER_SAW_ARRIVED_DEPOSIT_TX_PUBLISHED_MSG(Phase.DEPOSIT_PUBLISHED),
|
||||
@Deprecated SELLER_STORED_IN_MAILBOX_DEPOSIT_TX_PUBLISHED_MSG(Phase.DEPOSIT_PUBLISHED),
|
||||
@Deprecated SELLER_SEND_FAILED_DEPOSIT_TX_PUBLISHED_MSG(Phase.DEPOSIT_PUBLISHED),
|
||||
|
||||
// buyer perspective
|
||||
BUYER_RECEIVED_DEPOSIT_TX_PUBLISHED_MSG(Phase.DEPOSIT_PUBLISHED),
|
||||
|
@ -87,7 +87,7 @@ public abstract class SellerProtocol extends DisputeProtocol {
|
||||
}
|
||||
|
||||
protected void handle(ShareBuyerPaymentAccountMessage message, NodeAddress peer) {
|
||||
expect(anyPhase(Trade.Phase.DEPOSIT_PUBLISHED, Trade.Phase.DEPOSIT_CONFIRMED)
|
||||
expect(anyPhase(Trade.Phase.TAKER_FEE_PUBLISHED, Trade.Phase.DEPOSIT_PUBLISHED, Trade.Phase.DEPOSIT_CONFIRMED)
|
||||
.with(message)
|
||||
.from(peer))
|
||||
.setup(tasks(SellerProcessShareBuyerPaymentAccountMessage.class,
|
||||
|
@ -79,16 +79,15 @@ public class SellerSendsDepositTxAndDelayedPayoutTxMessage extends SendMailboxMe
|
||||
|
||||
@Override
|
||||
protected void setStateSent() {
|
||||
trade.setStateIfValidTransitionTo(Trade.State.SELLER_SENT_DEPOSIT_TX_PUBLISHED_MSG);
|
||||
|
||||
processModel.getTradeManager().requestPersistence();
|
||||
// we no longer set deprecated state (Trade.State.SELLER_SENT_DEPOSIT_TX_PUBLISHED_MSG);
|
||||
// see https://github.com/bisq-network/bisq/pull/5746#issuecomment-939879623
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setStateArrived() {
|
||||
trade.setStateIfValidTransitionTo(Trade.State.SELLER_SAW_ARRIVED_DEPOSIT_TX_PUBLISHED_MSG);
|
||||
// we no longer set deprecated state (Trade.State.SELLER_SAW_ARRIVED_DEPOSIT_TX_PUBLISHED_MSG);
|
||||
// see https://github.com/bisq-network/bisq/pull/5746#issuecomment-939879623
|
||||
|
||||
processModel.getTradeManager().requestPersistence();
|
||||
cleanup();
|
||||
// Complete is called in base class
|
||||
}
|
||||
@ -101,9 +100,9 @@ public class SellerSendsDepositTxAndDelayedPayoutTxMessage extends SendMailboxMe
|
||||
|
||||
@Override
|
||||
protected void setStateStoredInMailbox() {
|
||||
trade.setStateIfValidTransitionTo(Trade.State.SELLER_STORED_IN_MAILBOX_DEPOSIT_TX_PUBLISHED_MSG);
|
||||
// we no longer set deprecated state (Trade.State.SELLER_STORED_IN_MAILBOX_DEPOSIT_TX_PUBLISHED_MSG);
|
||||
// see https://github.com/bisq-network/bisq/pull/5746#issuecomment-939879623
|
||||
|
||||
processModel.getTradeManager().requestPersistence();
|
||||
// The DepositTxAndDelayedPayoutTxMessage is a mailbox message as earlier we use only the deposit tx which can
|
||||
// be also received from the network once published.
|
||||
// Now we send the delayed payout tx as well and with that this message is mandatory for continuing the protocol.
|
||||
@ -125,12 +124,11 @@ public class SellerSendsDepositTxAndDelayedPayoutTxMessage extends SendMailboxMe
|
||||
|
||||
@Override
|
||||
protected void setStateFault() {
|
||||
trade.setStateIfValidTransitionTo(Trade.State.SELLER_SEND_FAILED_DEPOSIT_TX_PUBLISHED_MSG);
|
||||
// we no longer set deprecated state (Trade.State.SELLER_SEND_FAILED_DEPOSIT_TX_PUBLISHED_MSG);
|
||||
// see https://github.com/bisq-network/bisq/pull/5746#issuecomment-939879623
|
||||
if (!trade.isDepositConfirmed()) {
|
||||
tryToSendAgainLater();
|
||||
}
|
||||
|
||||
processModel.getTradeManager().requestPersistence();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -184,9 +182,9 @@ public class SellerSendsDepositTxAndDelayedPayoutTxMessage extends SendMailboxMe
|
||||
// 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 SELLER_SAW_ARRIVED_DEPOSIT_TX_PUBLISHED_MSG
|
||||
trade.setStateIfValidTransitionTo(Trade.State.SELLER_SAW_ARRIVED_DEPOSIT_TX_PUBLISHED_MSG);
|
||||
// we no longer set deprecated state (Trade.State.SELLER_SAW_ARRIVED_DEPOSIT_TX_PUBLISHED_MSG);
|
||||
// see https://github.com/bisq-network/bisq/pull/5746#issuecomment-939879623
|
||||
|
||||
processModel.getTradeManager().requestPersistence();
|
||||
cleanup();
|
||||
complete();
|
||||
}
|
||||
|
@ -367,7 +367,8 @@ public class PendingTradesView extends ActivatableViewAndModel<VBox, PendingTrad
|
||||
}
|
||||
|
||||
private boolean isMaybeInvalidTrade(Trade trade) {
|
||||
return trade.isTxChainInvalid() || trade.hasErrorMessage();
|
||||
return trade.hasErrorMessage() ||
|
||||
(Trade.Phase.DEPOSIT_PUBLISHED.ordinal() <= trade.getPhase().ordinal() && trade.isTxChainInvalid());
|
||||
}
|
||||
|
||||
private void onMoveInvalidTradeToFailedTrades(Trade trade) {
|
||||
|
@ -433,15 +433,9 @@ public class PendingTradesViewModel extends ActivatableWithDataModel<PendingTrad
|
||||
|
||||
|
||||
// #################### Phase DEPOSIT_PAID
|
||||
case SELLER_PUBLISHED_DEPOSIT_TX:
|
||||
|
||||
// DEPOSIT_TX_PUBLISHED_MSG
|
||||
// seller perspective
|
||||
case SELLER_SENT_DEPOSIT_TX_PUBLISHED_MSG:
|
||||
case SELLER_SAW_ARRIVED_DEPOSIT_TX_PUBLISHED_MSG:
|
||||
case SELLER_STORED_IN_MAILBOX_DEPOSIT_TX_PUBLISHED_MSG:
|
||||
case SELLER_SEND_FAILED_DEPOSIT_TX_PUBLISHED_MSG:
|
||||
|
||||
case SELLER_PUBLISHED_DEPOSIT_TX:
|
||||
// buyer perspective
|
||||
case BUYER_RECEIVED_DEPOSIT_TX_PUBLISHED_MSG:
|
||||
|
||||
|
@ -1510,10 +1510,10 @@ message Trade {
|
||||
MAKER_SEND_FAILED_PUBLISH_DEPOSIT_TX_REQUEST = 6;
|
||||
TAKER_RECEIVED_PUBLISH_DEPOSIT_TX_REQUEST = 7;
|
||||
SELLER_PUBLISHED_DEPOSIT_TX = 8;
|
||||
SELLER_SENT_DEPOSIT_TX_PUBLISHED_MSG = 9;
|
||||
SELLER_SAW_ARRIVED_DEPOSIT_TX_PUBLISHED_MSG = 10;
|
||||
SELLER_STORED_IN_MAILBOX_DEPOSIT_TX_PUBLISHED_MSG = 11;
|
||||
SELLER_SEND_FAILED_DEPOSIT_TX_PUBLISHED_MSG = 12;
|
||||
SELLER_SENT_DEPOSIT_TX_PUBLISHED_MSG = 9 [deprecated = true];
|
||||
SELLER_SAW_ARRIVED_DEPOSIT_TX_PUBLISHED_MSG = 10 [deprecated = true];
|
||||
SELLER_STORED_IN_MAILBOX_DEPOSIT_TX_PUBLISHED_MSG = 11 [deprecated = true];
|
||||
SELLER_SEND_FAILED_DEPOSIT_TX_PUBLISHED_MSG = 12 [deprecated = true];
|
||||
BUYER_RECEIVED_DEPOSIT_TX_PUBLISHED_MSG = 13;
|
||||
BUYER_SAW_DEPOSIT_TX_IN_NETWORK = 14;
|
||||
DEPOSIT_CONFIRMED_IN_BLOCK_CHAIN = 15;
|
||||
|
Loading…
Reference in New Issue
Block a user