mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-07-28 09:24:15 -04:00
do not fetch trade txs directly from daemon
This commit is contained in:
parent
2e672260d3
commit
895acc9d7c
3 changed files with 23 additions and 42 deletions
|
@ -199,18 +199,18 @@ public class TxIdTextField extends AnchorPane {
|
|||
tx = useCache ? xmrWalletService.getDaemonTxWithCache(txId) : xmrWalletService.getDaemonTx(txId);
|
||||
tx.setNumConfirmations(tx.isConfirmed() ? (height == null ? xmrWalletService.getConnectionService().getLastInfo().getHeight() : height) - tx.getHeight(): 0l); // TODO: don't set if tx.getNumConfirmations() works reliably on non-local testnet
|
||||
} else {
|
||||
if (txId.equals(trade.getMaker().getDepositTxHash())) tx = trade.getMaker().getDepositTx();
|
||||
else if (txId.equals(trade.getTaker().getDepositTxHash())) tx = trade.getTaker().getDepositTx();
|
||||
if (txId.equals(trade.getMaker().getDepositTxHash())) tx = trade.getMakerDepositTx();
|
||||
else if (txId.equals(trade.getTaker().getDepositTxHash())) tx = trade.getTakerDepositTx();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// do nothing
|
||||
}
|
||||
updateConfidence(tx);
|
||||
updateConfidence(tx, trade);
|
||||
}
|
||||
|
||||
private void updateConfidence(MoneroTx tx) {
|
||||
private void updateConfidence(MoneroTx tx, Trade trade) {
|
||||
UserThread.execute(() -> {
|
||||
GUIUtil.updateConfidence(tx, progressIndicatorTooltip, txConfidenceIndicator);
|
||||
GUIUtil.updateConfidence(tx, trade, progressIndicatorTooltip, txConfidenceIndicator);
|
||||
if (txConfidenceIndicator.getProgress() != 0) {
|
||||
AnchorPane.setRightAnchor(txConfidenceIndicator, 0.0);
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ import haveno.core.payment.PaymentAccount;
|
|||
import haveno.core.payment.PaymentAccountList;
|
||||
import haveno.core.payment.payload.PaymentMethod;
|
||||
import haveno.core.trade.HavenoUtils;
|
||||
import haveno.core.trade.Trade;
|
||||
import haveno.core.user.DontShowAgainLookup;
|
||||
import haveno.core.user.Preferences;
|
||||
import haveno.core.user.User;
|
||||
|
@ -528,9 +529,21 @@ public class GUIUtil {
|
|||
public static void updateConfidence(MoneroTx tx,
|
||||
Tooltip tooltip,
|
||||
TxConfidenceIndicator txConfidenceIndicator) {
|
||||
updateConfidence(tx, null, tooltip, txConfidenceIndicator);
|
||||
}
|
||||
|
||||
public static void updateConfidence(MoneroTx tx,
|
||||
Trade trade,
|
||||
Tooltip tooltip,
|
||||
TxConfidenceIndicator txConfidenceIndicator) {
|
||||
if (tx == null || tx.getNumConfirmations() == null || !tx.isRelayed()) {
|
||||
tooltip.setText(Res.get("confidence.unknown"));
|
||||
txConfidenceIndicator.setProgress(-1);
|
||||
if (trade != null && trade.isDepositsUnlocked()) {
|
||||
tooltip.setText(Res.get("confidence.confirmed", ">=10"));
|
||||
txConfidenceIndicator.setProgress(1.0);
|
||||
} else {
|
||||
tooltip.setText(Res.get("confidence.unknown"));
|
||||
txConfidenceIndicator.setProgress(-1);
|
||||
}
|
||||
} else {
|
||||
if (tx.isFailed()) {
|
||||
tooltip.setText(Res.get("confidence.invalid"));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue