reduce monerod requests in transactions view by checking id equality

This commit is contained in:
woodser 2023-07-27 09:48:39 -04:00
parent a088f685c1
commit ee3e4fb383

View file

@ -27,7 +27,6 @@ import haveno.core.trade.Trade;
import haveno.core.xmr.wallet.XmrWalletService; import haveno.core.xmr.wallet.XmrWalletService;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
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.util.Optional; import java.util.Optional;
@ -68,24 +67,15 @@ class TransactionAwareTrade implements TransactionAwareTradable {
} }
private boolean isPayoutTx(String txId) { private boolean isPayoutTx(String txId) {
return Optional.ofNullable(trade.getPayoutTx()) return txId.equals(trade.getPayoutTxId());
.map(MoneroTx::getHash)
.map(hash -> hash.equals(txId))
.orElse(false);
} }
private boolean isMakerDepositTx(String txId) { private boolean isMakerDepositTx(String txId) {
return Optional.ofNullable(trade.getMakerDepositTx()) return txId.equals(trade.getMaker().getDepositTxHash());
.map(MoneroTx::getHash)
.map(hash -> hash.equals(txId))
.orElse(false);
} }
private boolean isTakerDepositTx(String txId) { private boolean isTakerDepositTx(String txId) {
return Optional.ofNullable(trade.getTakerDepositTx()) return txId.equals(trade.getTaker().getDepositTxHash());
.map(MoneroTx::getHash)
.map(hash -> hash.equals(txId))
.orElse(false);
} }
private boolean isOfferFeeTx(String txId) { private boolean isOfferFeeTx(String txId) {