mirror of
https://github.com/retoaccess1/haveno-reto.git
synced 2024-11-10 05:03:35 +01:00
update payout unlocked state if trade wallet missing
This commit is contained in:
parent
882f0d355f
commit
69b0d54c7e
3
Makefile
3
Makefile
@ -188,7 +188,8 @@ user1-desktop-local:
|
||||
--appName=haveno-XMR_LOCAL_user1 \
|
||||
--apiPassword=apitest \
|
||||
--apiPort=9999 \
|
||||
--walletRpcBindPort=38091
|
||||
--walletRpcBindPort=38091 \
|
||||
--logLevel=info
|
||||
|
||||
user2-desktop-local:
|
||||
./haveno-desktop$(APP_EXT) \
|
||||
|
@ -436,7 +436,7 @@ public abstract class Trade implements Tradable, Model {
|
||||
transient Boolean makerDepositLocked; // null when unknown, true while locked, false when unlocked
|
||||
transient Boolean takerDepositLocked;
|
||||
@Nullable
|
||||
transient private MoneroTxWallet payoutTx;
|
||||
transient private MoneroTx payoutTx;
|
||||
@Getter
|
||||
@Setter
|
||||
private String payoutTxId;
|
||||
@ -667,7 +667,16 @@ public abstract class Trade implements Tradable, Model {
|
||||
|
||||
// sync wallet if applicable
|
||||
if (!isDepositRequested() || isPayoutUnlocked()) return;
|
||||
if (!walletExists()) throw new IllegalStateException("Missing trade wallet for " + getClass().getSimpleName() + " " + getId());
|
||||
if (!walletExists()) {
|
||||
MoneroTx payoutTx = getPayoutTx();
|
||||
if (payoutTx != null && payoutTx.getNumConfirmations() >= 10) {
|
||||
log.warn("Payout state for {} {} is {} but payout is unlocked, updating state", getClass().getSimpleName(), getId(), getPayoutState());
|
||||
setPayoutStateUnlocked();
|
||||
return;
|
||||
} else {
|
||||
throw new IllegalStateException("Missing trade wallet for " + getClass().getSimpleName() + " " + getId());
|
||||
}
|
||||
}
|
||||
if (xmrWalletService.getConnectionsService().getConnection() == null || Boolean.FALSE.equals(xmrWalletService.getConnectionsService().isConnected())) return;
|
||||
updateSyncing();
|
||||
}
|
||||
@ -1631,8 +1640,10 @@ public abstract class Trade implements Tradable, Model {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public MoneroTxWallet getPayoutTx() {
|
||||
if (payoutTx == null) payoutTx = payoutTxId == null ? null : xmrWalletService.getWallet().getTx(payoutTxId);
|
||||
public MoneroTx getPayoutTx() {
|
||||
if (payoutTx == null) {
|
||||
payoutTx = payoutTxId == null ? null : (this instanceof ArbitratorTrade) ? xmrWalletService.getTxWithCache(payoutTxId) : xmrWalletService.getWallet().getTx(payoutTxId);
|
||||
}
|
||||
return payoutTx;
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ class TransactionAwareTrade implements TransactionAwareTradable {
|
||||
|
||||
private boolean isPayoutTx(String txId) {
|
||||
return Optional.ofNullable(trade.getPayoutTx())
|
||||
.map(MoneroTxWallet::getHash)
|
||||
.map(MoneroTx::getHash)
|
||||
.map(hash -> hash.equals(txId))
|
||||
.orElse(false);
|
||||
}
|
||||
|
@ -66,6 +66,7 @@ import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.VBox;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import monero.daemon.model.MoneroTx;
|
||||
import monero.wallet.model.MoneroTxWallet;
|
||||
|
||||
import java.math.BigInteger;
|
||||
@ -581,11 +582,11 @@ public class DisputeSummaryWindow extends Overlay<DisputeSummaryWindow> {
|
||||
closeTicketButton.setOnAction(e -> {
|
||||
|
||||
// get or create dispute payout tx
|
||||
MoneroTxWallet payoutTx = null;
|
||||
MoneroTx payoutTx = null;
|
||||
if (trade.isPayoutPublished()) payoutTx = trade.getPayoutTx();
|
||||
else {
|
||||
payoutTx = arbitrationManager.createDisputePayoutTx(trade, dispute.getContract(), disputeResult, false);
|
||||
trade.getProcessModel().setUnsignedPayoutTx(payoutTx);
|
||||
trade.getProcessModel().setUnsignedPayoutTx((MoneroTxWallet) payoutTx);
|
||||
}
|
||||
|
||||
// show confirmation
|
||||
@ -608,7 +609,7 @@ public class DisputeSummaryWindow extends Overlay<DisputeSummaryWindow> {
|
||||
});
|
||||
}
|
||||
|
||||
private void showPayoutTxConfirmation(Contract contract, DisputeResult disputeResult, MoneroTxWallet payoutTx, ResultHandler resultHandler) {
|
||||
private void showPayoutTxConfirmation(Contract contract, DisputeResult disputeResult, MoneroTx payoutTx, ResultHandler resultHandler) {
|
||||
BigInteger buyerPayoutAmount = disputeResult.getBuyerPayoutAmount();
|
||||
String buyerPayoutAddressString = contract.getBuyerPayoutAddressString();
|
||||
BigInteger sellerPayoutAmount = disputeResult.getSellerPayoutAmount();
|
||||
|
Loading…
Reference in New Issue
Block a user