mirror of
https://github.com/retoaccess1/haveno-reto.git
synced 2024-11-12 22:23:42 +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 \
|
--appName=haveno-XMR_LOCAL_user1 \
|
||||||
--apiPassword=apitest \
|
--apiPassword=apitest \
|
||||||
--apiPort=9999 \
|
--apiPort=9999 \
|
||||||
--walletRpcBindPort=38091
|
--walletRpcBindPort=38091 \
|
||||||
|
--logLevel=info
|
||||||
|
|
||||||
user2-desktop-local:
|
user2-desktop-local:
|
||||||
./haveno-desktop$(APP_EXT) \
|
./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 makerDepositLocked; // null when unknown, true while locked, false when unlocked
|
||||||
transient Boolean takerDepositLocked;
|
transient Boolean takerDepositLocked;
|
||||||
@Nullable
|
@Nullable
|
||||||
transient private MoneroTxWallet payoutTx;
|
transient private MoneroTx payoutTx;
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
private String payoutTxId;
|
private String payoutTxId;
|
||||||
@ -667,7 +667,16 @@ public abstract class Trade implements Tradable, Model {
|
|||||||
|
|
||||||
// sync wallet if applicable
|
// sync wallet if applicable
|
||||||
if (!isDepositRequested() || isPayoutUnlocked()) return;
|
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;
|
if (xmrWalletService.getConnectionsService().getConnection() == null || Boolean.FALSE.equals(xmrWalletService.getConnectionsService().isConnected())) return;
|
||||||
updateSyncing();
|
updateSyncing();
|
||||||
}
|
}
|
||||||
@ -1631,8 +1640,10 @@ public abstract class Trade implements Tradable, Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public MoneroTxWallet getPayoutTx() {
|
public MoneroTx getPayoutTx() {
|
||||||
if (payoutTx == null) payoutTx = payoutTxId == null ? null : xmrWalletService.getWallet().getTx(payoutTxId);
|
if (payoutTx == null) {
|
||||||
|
payoutTx = payoutTxId == null ? null : (this instanceof ArbitratorTrade) ? xmrWalletService.getTxWithCache(payoutTxId) : xmrWalletService.getWallet().getTx(payoutTxId);
|
||||||
|
}
|
||||||
return payoutTx;
|
return payoutTx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ class TransactionAwareTrade implements TransactionAwareTradable {
|
|||||||
|
|
||||||
private boolean isPayoutTx(String txId) {
|
private boolean isPayoutTx(String txId) {
|
||||||
return Optional.ofNullable(trade.getPayoutTx())
|
return Optional.ofNullable(trade.getPayoutTx())
|
||||||
.map(MoneroTxWallet::getHash)
|
.map(MoneroTx::getHash)
|
||||||
.map(hash -> hash.equals(txId))
|
.map(hash -> hash.equals(txId))
|
||||||
.orElse(false);
|
.orElse(false);
|
||||||
}
|
}
|
||||||
|
@ -66,6 +66,7 @@ import javafx.scene.layout.GridPane;
|
|||||||
import javafx.scene.layout.HBox;
|
import javafx.scene.layout.HBox;
|
||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import monero.daemon.model.MoneroTx;
|
||||||
import monero.wallet.model.MoneroTxWallet;
|
import monero.wallet.model.MoneroTxWallet;
|
||||||
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
@ -581,11 +582,11 @@ public class DisputeSummaryWindow extends Overlay<DisputeSummaryWindow> {
|
|||||||
closeTicketButton.setOnAction(e -> {
|
closeTicketButton.setOnAction(e -> {
|
||||||
|
|
||||||
// get or create dispute payout tx
|
// get or create dispute payout tx
|
||||||
MoneroTxWallet payoutTx = null;
|
MoneroTx payoutTx = null;
|
||||||
if (trade.isPayoutPublished()) payoutTx = trade.getPayoutTx();
|
if (trade.isPayoutPublished()) payoutTx = trade.getPayoutTx();
|
||||||
else {
|
else {
|
||||||
payoutTx = arbitrationManager.createDisputePayoutTx(trade, dispute.getContract(), disputeResult, false);
|
payoutTx = arbitrationManager.createDisputePayoutTx(trade, dispute.getContract(), disputeResult, false);
|
||||||
trade.getProcessModel().setUnsignedPayoutTx(payoutTx);
|
trade.getProcessModel().setUnsignedPayoutTx((MoneroTxWallet) payoutTx);
|
||||||
}
|
}
|
||||||
|
|
||||||
// show confirmation
|
// 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();
|
BigInteger buyerPayoutAmount = disputeResult.getBuyerPayoutAmount();
|
||||||
String buyerPayoutAddressString = contract.getBuyerPayoutAddressString();
|
String buyerPayoutAddressString = contract.getBuyerPayoutAddressString();
|
||||||
BigInteger sellerPayoutAmount = disputeResult.getSellerPayoutAmount();
|
BigInteger sellerPayoutAmount = disputeResult.getSellerPayoutAmount();
|
||||||
|
Loading…
Reference in New Issue
Block a user