treat SELLER_SAW_ARRIVED_PAYMENT_RECEIVED_MSG as payout until refactored

This commit is contained in:
woodser 2022-07-11 08:59:12 -04:00
parent 8980a8ec60
commit defb82d240
3 changed files with 4 additions and 3 deletions

View file

@ -1332,6 +1332,7 @@ public abstract class Trade implements Tradable, Model {
} }
public boolean isPayoutPublished() { public boolean isPayoutPublished() {
if (getState() == Trade.State.SELLER_SAW_ARRIVED_PAYMENT_RECEIVED_MSG) return true; // TODO: this is a hack because seller has not seen signed payout tx. replace when payout process refactored
return getState().getPhase().ordinal() >= Phase.PAYOUT_PUBLISHED.ordinal() || isWithdrawn(); return getState().getPhase().ordinal() >= Phase.PAYOUT_PUBLISHED.ordinal() || isWithdrawn();
} }

View file

@ -161,7 +161,7 @@ public abstract class BuyerProtocol extends DisputeProtocol {
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
protected void handle(PaymentReceivedMessage message, NodeAddress peer) { protected void handle(PaymentReceivedMessage message, NodeAddress peer) {
log.info("BuyerProtocol.handle(SellerReceivedPaymentMessage)"); log.info("BuyerProtocol.handle(PaymentReceivedMessage)");
synchronized (trade) { synchronized (trade) {
processModel.setTradeMessage(message); processModel.setTradeMessage(message);
processModel.setTempTradingPeerNodeAddress(peer); processModel.setTempTradingPeerNodeAddress(peer);

View file

@ -86,7 +86,7 @@ public class SellerSendsPaymentReceivedMessage extends SendMailboxMessageTask {
@Override @Override
protected void setStateArrived() { protected void setStateArrived() {
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); 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 {}", log.info("Seller's PaymentReceivedMessage arrived: tradeId={} at peer {} SignedWitness {}",
trade.getId(), trade.getTradingPeerNodeAddress(), signedWitness); trade.getId(), trade.getTradingPeerNodeAddress(), signedWitness);
processModel.getTradeManager().requestPersistence(); processModel.getTradeManager().requestPersistence();
} }
@ -94,7 +94,7 @@ public class SellerSendsPaymentReceivedMessage extends SendMailboxMessageTask {
@Override @Override
protected void setStateStoredInMailbox() { protected void setStateStoredInMailbox() {
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); 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 {}", log.info("Seller's PaymentReceivedMessage stored in mailbox: tradeId={} at peer {} SignedWitness {}",
trade.getId(), trade.getTradingPeerNodeAddress(), signedWitness); trade.getId(), trade.getTradingPeerNodeAddress(), signedWitness);
processModel.getTradeManager().requestPersistence(); processModel.getTradeManager().requestPersistence();
} }