mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-07-20 05:43:18 -04:00
refactor base wallet so trades can sync with progress timeout, etc
This commit is contained in:
parent
1b5c03bce8
commit
ca7d596175
23 changed files with 247 additions and 226 deletions
|
@ -197,7 +197,7 @@ public class TxIdTextField extends AnchorPane {
|
|||
try {
|
||||
if (trade == null) {
|
||||
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
|
||||
tx.setNumConfirmations(tx.isConfirmed() ? (height == null ? xmrWalletService.getXmrConnectionService().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.getMakerDepositTx();
|
||||
else if (txId.equals(trade.getTaker().getDepositTxHash())) tx = trade.getTakerDepositTx();
|
||||
|
|
|
@ -257,7 +257,7 @@ public class WithdrawalView extends ActivatableView<VBox, Void> {
|
|||
// create tx
|
||||
MoneroTxWallet tx = null;
|
||||
for (int i = 0; i < TradeProtocol.MAX_ATTEMPTS; i++) {
|
||||
MoneroRpcConnection sourceConnection = xmrWalletService.getConnectionService().getConnection();
|
||||
MoneroRpcConnection sourceConnection = xmrWalletService.getXmrConnectionService().getConnection();
|
||||
try {
|
||||
log.info("Creating withdraw tx");
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
@ -272,7 +272,7 @@ public class WithdrawalView extends ActivatableView<VBox, Void> {
|
|||
if (isNotEnoughMoney(e.getMessage())) throw e;
|
||||
log.warn("Error creating creating withdraw tx, attempt={}/{}, error={}", i + 1, TradeProtocol.MAX_ATTEMPTS, e.getMessage());
|
||||
if (i == TradeProtocol.MAX_ATTEMPTS - 1) throw e;
|
||||
if (xmrWalletService.getConnectionService().isConnected()) xmrWalletService.requestSwitchToNextBestConnection(sourceConnection);
|
||||
if (xmrWalletService.getXmrConnectionService().isConnected()) xmrWalletService.requestSwitchToNextBestConnection(sourceConnection);
|
||||
HavenoUtils.waitFor(TradeProtocol.REPROCESS_DELAY_MS); // wait before retrying
|
||||
}
|
||||
}
|
||||
|
|
|
@ -701,7 +701,7 @@ public class GUIUtil {
|
|||
}
|
||||
|
||||
public static boolean isReadyForTxBroadcastOrShowPopup(XmrWalletService xmrWalletService) {
|
||||
XmrConnectionService xmrConnectionService = xmrWalletService.getConnectionService();
|
||||
XmrConnectionService xmrConnectionService = xmrWalletService.getXmrConnectionService();
|
||||
if (!xmrConnectionService.hasSufficientPeersForBroadcast()) {
|
||||
new Popup().information(Res.get("popup.warning.notSufficientConnectionsToXmrNetwork", xmrConnectionService.getMinBroadcastConnections())).show();
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue