mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 23:18:17 +01:00
Fix deposit tx setters
This commit is contained in:
parent
568dcdaad4
commit
95cb3b2710
5 changed files with 38 additions and 28 deletions
|
@ -123,7 +123,7 @@ public abstract class Trade implements Tradable, Model {
|
|||
// maker perspective
|
||||
MAKER_SENT_PUBLISH_DEPOSIT_TX_REQUEST(Phase.TAKER_FEE_PUBLISHED),
|
||||
MAKER_SAW_ARRIVED_PUBLISH_DEPOSIT_TX_REQUEST(Phase.TAKER_FEE_PUBLISHED),
|
||||
MAKER_STORED_IN_MAILBOX_PUBLISH_DEPOSIT_TX_REQUEST(Phase.TAKER_FEE_PUBLISHED), //todo remove
|
||||
MAKER_STORED_IN_MAILBOX_PUBLISH_DEPOSIT_TX_REQUEST(Phase.TAKER_FEE_PUBLISHED), //not a mailbox msg, not used...
|
||||
MAKER_SEND_FAILED_PUBLISH_DEPOSIT_TX_REQUEST(Phase.TAKER_FEE_PUBLISHED),
|
||||
|
||||
// taker perspective
|
||||
|
@ -1232,8 +1232,9 @@ public abstract class Trade implements Tradable, Model {
|
|||
|
||||
private void setConfirmedState() {
|
||||
// we only apply the state if we are not already further in the process
|
||||
if (!isDepositConfirmed())
|
||||
if (!isDepositConfirmed()) {
|
||||
setState(State.DEPOSIT_CONFIRMED_IN_BLOCK_CHAIN);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -86,7 +86,7 @@ public class BuyerAsTakerSignsDepositTx extends TradeTask {
|
|||
sellerInputs,
|
||||
buyerMultiSigPubKey,
|
||||
sellerMultiSigPubKey);
|
||||
trade.applyDepositTx(depositTx);
|
||||
processModel.setDepositTx(depositTx);
|
||||
|
||||
complete();
|
||||
} catch (Throwable t) {
|
||||
|
|
|
@ -46,7 +46,7 @@ public class SellerAsMakerFinalizesDepositTx extends TradeTask {
|
|||
int numTakersInputs = checkNotNull(processModel.getTradingPeer().getRawTransactionInputs()).size();
|
||||
processModel.getTradeWalletService().sellerAsMakerFinalizesDepositTx(myDepositTx, takersDepositTx, numTakersInputs);
|
||||
|
||||
trade.applyDepositTx(myDepositTx);
|
||||
processModel.setDepositTx(myDepositTx);
|
||||
|
||||
complete();
|
||||
} catch (Throwable t) {
|
||||
|
|
|
@ -57,14 +57,12 @@ public class TakerPublishFeeTx extends TradeTask {
|
|||
new TxBroadcaster.Callback() {
|
||||
@Override
|
||||
public void onSuccess(Transaction transaction) {
|
||||
trade.setTakerFeeTxId(transaction.getTxId().toString());
|
||||
trade.setState(Trade.State.TAKER_PUBLISHED_TAKER_FEE_TX);
|
||||
complete();
|
||||
TakerPublishFeeTx.this.onSuccess(transaction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(TxBroadcastException exception) {
|
||||
failed(exception);
|
||||
TakerPublishFeeTx.this.onFailure(exception);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
@ -79,29 +77,12 @@ public class TakerPublishFeeTx extends TradeTask {
|
|||
new TxBroadcaster.Callback() {
|
||||
@Override
|
||||
public void onSuccess(@Nullable Transaction transaction) {
|
||||
if (!completed) {
|
||||
if (transaction != null) {
|
||||
trade.setTakerFeeTxId(transaction.getTxId().toString());
|
||||
trade.setState(Trade.State.TAKER_PUBLISHED_TAKER_FEE_TX);
|
||||
complete();
|
||||
}
|
||||
} else {
|
||||
log.warn("We got the onSuccess callback called after the timeout has been triggered a complete().");
|
||||
}
|
||||
TakerPublishFeeTx.this.onSuccess(transaction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(TxBroadcastException exception) {
|
||||
if (!completed) {
|
||||
log.error(exception.toString());
|
||||
exception.printStackTrace();
|
||||
trade.setErrorMessage("An error occurred.\n" +
|
||||
"Error message:\n"
|
||||
+ exception.getMessage());
|
||||
failed(exception);
|
||||
} else {
|
||||
log.warn("We got the onFailure callback called after the timeout has been triggered a complete().");
|
||||
}
|
||||
TakerPublishFeeTx.this.onFailure(exception);
|
||||
}
|
||||
},
|
||||
1);
|
||||
|
@ -110,4 +91,29 @@ public class TakerPublishFeeTx extends TradeTask {
|
|||
failed(t);
|
||||
}
|
||||
}
|
||||
|
||||
protected void onFailure(TxBroadcastException exception) {
|
||||
if (!completed) {
|
||||
log.error(exception.toString());
|
||||
exception.printStackTrace();
|
||||
trade.setErrorMessage("An error occurred.\n" +
|
||||
"Error message:\n"
|
||||
+ exception.getMessage());
|
||||
failed(exception);
|
||||
} else {
|
||||
log.warn("We got the onFailure callback called after the timeout has been triggered a complete().");
|
||||
}
|
||||
}
|
||||
|
||||
protected void onSuccess(@org.jetbrains.annotations.Nullable Transaction transaction) {
|
||||
if (!completed) {
|
||||
if (transaction != null) {
|
||||
trade.setTakerFeeTxId(transaction.getTxId().toString());
|
||||
trade.setState(Trade.State.TAKER_PUBLISHED_TAKER_FEE_TX);
|
||||
complete();
|
||||
}
|
||||
} else {
|
||||
log.warn("We got the onSuccess callback called after the timeout has been triggered a complete().");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -507,8 +507,11 @@ public class BuyerStep2View extends TradeStepView {
|
|||
private void confirmPaymentStarted() {
|
||||
busyAnimation.play();
|
||||
statusLabel.setText(Res.get("shared.sendingConfirmation"));
|
||||
if (trade.isFiatSent())
|
||||
|
||||
//TODO seems this was a hack to enable repeated confirm???
|
||||
if (trade.isFiatSent()) {
|
||||
trade.setState(Trade.State.DEPOSIT_CONFIRMED_IN_BLOCK_CHAIN);
|
||||
}
|
||||
|
||||
model.dataModel.onPaymentStarted(() -> {
|
||||
}, errorMessage -> {
|
||||
|
|
Loading…
Add table
Reference in a new issue