replace BigInteger.valueOf(0) with BigInteger.ZERO

This commit is contained in:
woodser 2023-12-08 07:45:22 -05:00
parent cd89b8bf15
commit 3730773006
34 changed files with 81 additions and 81 deletions

View file

@ -218,12 +218,12 @@ public class CoreDisputesService {
disputeResult.setSellerPayoutAmountBeforeCost(sellerSecurityDeposit);
} else if (payout == DisputePayout.BUYER_GETS_ALL) {
disputeResult.setBuyerPayoutAmountBeforeCost(tradeAmount.add(buyerSecurityDeposit).add(sellerSecurityDeposit)); // TODO (woodser): apply min payout to incentivize loser? (see post v1.1.7)
disputeResult.setSellerPayoutAmountBeforeCost(BigInteger.valueOf(0));
disputeResult.setSellerPayoutAmountBeforeCost(BigInteger.ZERO);
} else if (payout == DisputePayout.SELLER_GETS_TRADE_AMOUNT) {
disputeResult.setBuyerPayoutAmountBeforeCost(buyerSecurityDeposit);
disputeResult.setSellerPayoutAmountBeforeCost(tradeAmount.add(sellerSecurityDeposit));
} else if (payout == DisputePayout.SELLER_GETS_ALL) {
disputeResult.setBuyerPayoutAmountBeforeCost(BigInteger.valueOf(0));
disputeResult.setBuyerPayoutAmountBeforeCost(BigInteger.ZERO);
disputeResult.setSellerPayoutAmountBeforeCost(tradeAmount.add(sellerSecurityDeposit).add(buyerSecurityDeposit));
} else if (payout == DisputePayout.CUSTOM) {
if (customWinnerAmount > trade.getWallet().getBalance().longValueExact()) throw new RuntimeException("Winner payout is more than the trade wallet's balance");

View file

@ -94,7 +94,7 @@ public class Price extends MonetaryWrapper implements Comparable<Price> {
else if (monetary instanceof CryptoMoney && this.monetary instanceof CryptoMoney)
return HavenoUtils.coinToAtomicUnits(new CryptoExchangeRate((CryptoMoney) this.monetary).cryptoToCoin((CryptoMoney) monetary));
else
return BigInteger.valueOf(0);
return BigInteger.ZERO;
}
public String getCurrencyCode() {

View file

@ -143,9 +143,9 @@ public class OfferUtil {
public BigInteger getBalanceShortage(BigInteger cost, BigInteger balance) {
if (cost != null) {
BigInteger shortage = cost.subtract(balance);
return shortage.compareTo(BigInteger.valueOf(0)) < 0 ? BigInteger.valueOf(0) : shortage;
return shortage.compareTo(BigInteger.ZERO) < 0 ? BigInteger.ZERO : shortage;
} else {
return BigInteger.valueOf(0);
return BigInteger.ZERO;
}
}

View file

@ -1029,7 +1029,7 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
// get earliest unscheduled txs with sufficient incoming amount
List<String> scheduledTxHashes = new ArrayList<String>();
BigInteger scheduledAmount = BigInteger.valueOf(0);
BigInteger scheduledAmount = BigInteger.ZERO;
for (MoneroTxWallet lockedTx : lockedTxs) {
if (isTxScheduled(openOffers, lockedTx.getHash())) continue;
if (lockedTx.getIncomingTransfers() == null || lockedTx.getIncomingTransfers().isEmpty()) continue;
@ -1048,7 +1048,7 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
}
private BigInteger getScheduledAmount(List<OpenOffer> openOffers) {
BigInteger scheduledAmount = BigInteger.valueOf(0);
BigInteger scheduledAmount = BigInteger.ZERO;
for (OpenOffer openOffer : openOffers) {
if (openOffer.getState() != OpenOffer.State.SCHEDULED) continue;
if (openOffer.getScheduledTxHashes() == null) continue;
@ -1178,7 +1178,7 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
}
// verify maker's reserve tx (double spend, trade fee, trade amount, mining fee)
BigInteger sendAmount = offer.getDirection() == OfferDirection.BUY ? BigInteger.valueOf(0) : offer.getAmount();
BigInteger sendAmount = offer.getDirection() == OfferDirection.BUY ? BigInteger.ZERO : offer.getAmount();
BigInteger securityDeposit = offer.getDirection() == OfferDirection.BUY ? offer.getMaxBuyerSecurityDeposit() : offer.getMaxSellerSecurityDeposit();
Tuple2<MoneroTx, BigInteger> txResult = xmrWalletService.verifyTradeTx(
offer.getId(),

View file

@ -51,7 +51,7 @@ public class MakerReserveOfferFunds extends Task<PlaceOfferModel> {
// create reserve tx
BigInteger makerFee = offer.getMakerFee();
BigInteger sendAmount = offer.getDirection() == OfferDirection.BUY ? BigInteger.valueOf(0) : offer.getAmount();
BigInteger sendAmount = offer.getDirection() == OfferDirection.BUY ? BigInteger.ZERO : offer.getAmount();
BigInteger securityDeposit = offer.getDirection() == OfferDirection.BUY ? offer.getMaxBuyerSecurityDeposit() : offer.getMaxSellerSecurityDeposit();
String returnAddress = model.getXmrWalletService().getOrCreateAddressEntry(offer.getId(), XmrAddressEntry.Context.TRADE_PAYOUT).getAddressString();
XmrAddressEntry fundingEntry = model.getXmrWalletService().getAddressEntry(offer.getId(), XmrAddressEntry.Context.OFFER_FUNDING).orElse(null);

View file

@ -102,7 +102,7 @@ public class ValidateOffer extends Task<PlaceOfferModel> {
public static void checkBINotNullOrZero(BigInteger value, String name) {
checkNotNull(value, name + " is null");
checkArgument(value.compareTo(BigInteger.valueOf(0)) > 0,
checkArgument(value.compareTo(BigInteger.ZERO) > 0,
name + " must be positive. " + name + "=" + value);
}

View file

@ -66,7 +66,7 @@ public class TakeOfferModel implements Model {
@Getter
private BigInteger totalToPay;
@Getter
private BigInteger missingCoin = BigInteger.valueOf(0);
private BigInteger missingCoin = BigInteger.ZERO;
@Getter
private BigInteger totalAvailableBalance;
@Getter
@ -156,7 +156,7 @@ public class TakeOfferModel implements Model {
@NotNull
public BigInteger getFundsNeededForTrade() {
// If taking a buy offer, taker needs to reserve the offer.amt too.
return securityDeposit.add(offer.isBuyOffer() ? amount : BigInteger.valueOf(0));
return securityDeposit.add(offer.isBuyOffer() ? amount : BigInteger.ZERO);
}
private void validateModelInputs() {
@ -173,7 +173,7 @@ public class TakeOfferModel implements Model {
this.amount = null;
this.availableBalance = null;
this.isXmrWalletFunded = false;
this.missingCoin = BigInteger.valueOf(0);
this.missingCoin = BigInteger.ZERO;
this.offer = null;
this.paymentAccount = null;
this.securityDeposit = null;

View file

@ -367,7 +367,7 @@ public final class PaymentMethod implements PersistablePayload, Comparable<Payme
}
public static PaymentMethod getDummyPaymentMethod(String id) {
return new PaymentMethod(id, 0, BigInteger.valueOf(0), Arrays.asList());
return new PaymentMethod(id, 0, BigInteger.ZERO, Arrays.asList());
}
@ -417,7 +417,7 @@ public final class PaymentMethod implements PersistablePayload, Comparable<Payme
// Used for dummy entries in payment methods list (SHOW_ALL)
private PaymentMethod(String id) {
this(id, 0, BigInteger.valueOf(0), new ArrayList<String>());
this(id, 0, BigInteger.ZERO, new ArrayList<String>());
}

View file

@ -1051,7 +1051,7 @@ public abstract class DisputeManager<T extends DisputeList<Dispute>> extends Sup
String optionTradeDetails;
// We don't translate those strings (yet) as it is only displayed to mediators/arbitrators.
String headline;
if (potentialGain.compareTo(BigInteger.valueOf(0)) > 0) {
if (potentialGain.compareTo(BigInteger.ZERO) > 0) {
headline = "This might be a potential option trade!";
optionTradeDetails = "\nBTC amount calculated with price at dispute opening: " + HavenoUtils.formatXmr(potentialAmountAtDisputeOpening, true) +
"\nMax loss of security deposit is: " + HavenoUtils.formatXmr(maxLossSecDeposit, true) +

View file

@ -386,7 +386,7 @@ public final class ArbitrationManager extends DisputeManager<ArbitrationDisputeL
// verify payouts sum to unlocked balance within loss of precision due to conversion to centineros
BigInteger txCost = arbitratorSignedPayoutTx.getFee().add(arbitratorSignedPayoutTx.getChangeAmount()); // cost = fee + lost dust change
if (!arbitratorSignedPayoutTx.getChangeAmount().equals(BigInteger.ZERO)) log.warn("Dust left in multisig wallet for {} {}: {}", getClass().getSimpleName(), trade.getId(), arbitratorSignedPayoutTx.getChangeAmount());
if (trade.getWallet().getUnlockedBalance().subtract(actualBuyerAmount.add(actualSellerAmount).add(txCost)).compareTo(BigInteger.valueOf(0)) > 0) {
if (trade.getWallet().getUnlockedBalance().subtract(actualBuyerAmount.add(actualSellerAmount).add(txCost)).compareTo(BigInteger.ZERO) > 0) {
throw new RuntimeException("The dispute payout amounts do not sum to the wallet's unlocked balance while verifying the dispute payout tx, unlocked balance=" + trade.getWallet().getUnlockedBalance() + " vs sum payout amount=" + actualBuyerAmount.add(actualSellerAmount) + ", buyer payout=" + actualBuyerAmount + ", seller payout=" + actualSellerAmount);
}
@ -452,7 +452,7 @@ public final class ArbitrationManager extends DisputeManager<ArbitrationDisputeL
public static BigInteger[] getBuyerSellerPayoutTxCost(DisputeResult disputeResult, BigInteger payoutTxCost) {
boolean isBuyerWinner = disputeResult.getWinner() == Winner.BUYER;
BigInteger loserAmount = isBuyerWinner ? disputeResult.getSellerPayoutAmountBeforeCost() : disputeResult.getBuyerPayoutAmountBeforeCost();
if (loserAmount.equals(BigInteger.valueOf(0))) {
if (loserAmount.equals(BigInteger.ZERO)) {
BigInteger buyerPayoutTxFee = isBuyerWinner ? payoutTxCost : BigInteger.ZERO;
BigInteger sellerPayoutTxFee = isBuyerWinner ? BigInteger.ZERO : payoutTxCost;
return new BigInteger[] { buyerPayoutTxFee, sellerPayoutTxFee };

View file

@ -216,8 +216,8 @@ public class ClosedTradableManager implements PersistedDataHost {
public BigInteger getXmrTradeFee(Tradable tradable) {
return isMaker(tradable) ?
tradable.getOptionalMakerFee().orElse(BigInteger.valueOf(0)) :
tradable.getOptionalTakerFee().orElse(BigInteger.valueOf(0));
tradable.getOptionalMakerFee().orElse(BigInteger.ZERO) :
tradable.getOptionalTakerFee().orElse(BigInteger.ZERO);
}
public boolean isMaker(Tradable tradable) {

View file

@ -199,11 +199,11 @@ public class HavenoUtils {
}
public static BigInteger parseXmr(String input) {
if (input == null || input.length() == 0) return BigInteger.valueOf(0);
if (input == null || input.length() == 0) return BigInteger.ZERO;
try {
return xmrToAtomicUnits(new BigDecimal(ParsingUtils.parseNumberStringToDouble(input)).doubleValue());
} catch (Exception e) {
return BigInteger.valueOf(0);
return BigInteger.ZERO;
}
}
@ -247,7 +247,7 @@ public class HavenoUtils {
public static BigInteger getFeePerXmr(BigInteger feePerXmr, BigInteger amount) {
BigDecimal feePerXmrAsDecimal = feePerXmr == null ? BigDecimal.valueOf(0) : new BigDecimal(feePerXmr);
BigDecimal amountMultiplier = BigDecimal.valueOf(divide(amount == null ? BigInteger.valueOf(0) : amount, HavenoUtils.xmrToAtomicUnits(1.0)));
BigDecimal amountMultiplier = BigDecimal.valueOf(divide(amount == null ? BigInteger.ZERO : amount, HavenoUtils.xmrToAtomicUnits(1.0)));
return feePerXmrAsDecimal.multiply(amountMultiplier).toBigInteger();
}

View file

@ -1658,7 +1658,7 @@ public abstract class Trade implements Tradable, Model {
}
public BigInteger getFrozenAmount() {
BigInteger sum = BigInteger.valueOf(0);
BigInteger sum = BigInteger.ZERO;
for (String keyImage : getSelf().getReserveTxKeyImages()) {
List<MoneroOutputWallet> outputs = xmrWalletService.getWallet().getOutputs(new MoneroOutputQuery().setIsFrozen(true).setIsSpent(false).setKeyImage(new MoneroKeyImage(keyImage))); // TODO: will this check tx pool? avoid
if (!outputs.isEmpty()) sum = sum.add(outputs.get(0).getAmount());
@ -1667,7 +1667,7 @@ public abstract class Trade implements Tradable, Model {
}
public BigInteger getReservedAmount() {
if (isArbitrator() || !isDepositsPublished() || isPayoutPublished()) return BigInteger.valueOf(0);
if (isArbitrator() || !isDepositsPublished() || isPayoutPublished()) return BigInteger.ZERO;
return isBuyer() ? getBuyer().getSecurityDeposit() : getAmount().add(getSeller().getSecurityDeposit());
}

View file

@ -80,7 +80,7 @@ public class ArbitratorProcessDepositRequest extends TradeTask {
boolean isFromTaker = trader == trade.getTaker();
boolean isFromBuyer = trader == trade.getBuyer();
BigInteger tradeFee = isFromTaker ? trade.getTakerFee() : trade.getMakerFee();
BigInteger sendAmount = isFromBuyer ? BigInteger.valueOf(0) : trade.getAmount();
BigInteger sendAmount = isFromBuyer ? BigInteger.ZERO : trade.getAmount();
BigInteger securityDeposit = isFromBuyer ? trade.getBuyerSecurityDepositBeforeMiningFee() : trade.getSellerSecurityDepositBeforeMiningFee();
String depositAddress = processModel.getMultisigAddress();

View file

@ -55,7 +55,7 @@ public class ArbitratorProcessReserveTx extends TradeTask {
// process reserve tx with expected values
BigInteger tradeFee = isFromMaker ? trade.getMakerFee() : trade.getTakerFee();
BigInteger sendAmount = isFromBuyer ? BigInteger.valueOf(0) : isFromMaker ? offer.getAmount() : trade.getAmount(); // maker reserve tx is for offer amount
BigInteger sendAmount = isFromBuyer ? BigInteger.ZERO : isFromMaker ? offer.getAmount() : trade.getAmount(); // maker reserve tx is for offer amount
BigInteger securityDeposit = isFromMaker ? isFromBuyer ? offer.getMaxBuyerSecurityDeposit() : offer.getMaxSellerSecurityDeposit() : isFromBuyer ? trade.getBuyerSecurityDepositBeforeMiningFee() : trade.getSellerSecurityDepositBeforeMiningFee();
Tuple2<MoneroTx, BigInteger> txResult;
try {

View file

@ -41,7 +41,7 @@ public class TakerReserveTradeFunds extends TradeTask {
// create reserve tx
BigInteger takerFee = trade.getTakerFee();
BigInteger sendAmount = trade.getOffer().getDirection() == OfferDirection.BUY ? trade.getAmount() : BigInteger.valueOf(0);
BigInteger sendAmount = trade.getOffer().getDirection() == OfferDirection.BUY ? trade.getAmount() : BigInteger.ZERO;
BigInteger securityDeposit = trade.getOffer().getDirection() == OfferDirection.BUY ? trade.getSellerSecurityDepositBeforeMiningFee() : trade.getBuyerSecurityDepositBeforeMiningFee();
String returnAddress = model.getXmrWalletService().getOrCreateAddressEntry(trade.getOffer().getId(), XmrAddressEntry.Context.TRADE_PAYOUT).getAddressString();
MoneroTxWallet reserveTx = model.getXmrWalletService().createReserveTx(takerFee, sendAmount, securityDeposit, returnAddress, false, null);

View file

@ -62,7 +62,7 @@ public class CoinUtil {
* @return The percentage value as double (e.g. 1% is 0.01)
*/
public static double getAsPercentPerBtc(BigInteger part, BigInteger total) {
return MathUtils.roundDouble(HavenoUtils.divide(part == null ? BigInteger.valueOf(0) : part, total == null ? BigInteger.valueOf(1) : total), 4);
return MathUtils.roundDouble(HavenoUtils.divide(part == null ? BigInteger.ZERO : part, total == null ? BigInteger.valueOf(1) : total), 4);
}
/**
@ -71,7 +71,7 @@ public class CoinUtil {
* @return The percentage as atomic units (e.g. 1% of 1 BTC is 0.01 BTC)
*/
public static BigInteger getPercentOfAmount(double percent, BigInteger amount) {
if (amount == null) amount = BigInteger.valueOf(0);
if (amount == null) amount = BigInteger.ZERO;
return BigDecimal.valueOf(percent).multiply(new BigDecimal(amount)).setScale(8, RoundingMode.DOWN).toBigInteger();
}
@ -134,7 +134,7 @@ public class CoinUtil {
// 10 EUR in case of HalCash.
Volume smallestUnitForVolume = Volume.parse(String.valueOf(factor), price.getCurrencyCode());
if (smallestUnitForVolume.getValue() <= 0)
return BigInteger.valueOf(0);
return BigInteger.ZERO;
BigInteger smallestUnitForAmount = price.getAmountByVolume(smallestUnitForVolume);
long minTradeAmount = Restrictions.getMinTradeAmount().longValueExact();
@ -152,7 +152,7 @@ public class CoinUtil {
? getAdjustedVolumeUnit(price.getVolumeByAmount(smallestUnitForAmount), factor)
: getAdjustedVolumeUnit(price.getVolumeByAmount(amount), factor);
if (volume.getValue() <= 0)
return BigInteger.valueOf(0);
return BigInteger.ZERO;
// From that adjusted volume we calculate back the amount. It might be a bit different as
// the amount used as input before due rounding.

View file

@ -101,12 +101,12 @@ public class Balances {
// TODO (woodser): converting to long should generally be avoided since can lose precision, but in practice these amounts are below max value
private void updateAvailableBalance() {
availableBalance.set(xmrWalletService.getWallet() == null ? BigInteger.valueOf(0) : xmrWalletService.getWallet().getUnlockedBalance(0));
availableBalance.set(xmrWalletService.getWallet() == null ? BigInteger.ZERO : xmrWalletService.getWallet().getUnlockedBalance(0));
}
private void updatePendingBalance() {
BigInteger balance = xmrWalletService.getWallet() == null ? BigInteger.valueOf(0) : xmrWalletService.getWallet().getBalance(0);
BigInteger unlockedBalance = xmrWalletService.getWallet() == null ? BigInteger.valueOf(0) : xmrWalletService.getWallet().getUnlockedBalance(0);
BigInteger balance = xmrWalletService.getWallet() == null ? BigInteger.ZERO : xmrWalletService.getWallet().getBalance(0);
BigInteger unlockedBalance = xmrWalletService.getWallet() == null ? BigInteger.ZERO : xmrWalletService.getWallet().getUnlockedBalance(0);
BigInteger pendingBalanceSum = balance.subtract(unlockedBalance);
// add frozen trade balances - reserved amounts
@ -122,7 +122,7 @@ public class Balances {
}
private void updateReservedOfferBalance() {
BigInteger sum = BigInteger.valueOf(0);
BigInteger sum = BigInteger.ZERO;
if (xmrWalletService.getWallet() != null) {
List<MoneroOutputWallet> frozenOutputs = xmrWalletService.getWallet().getOutputs(new MoneroOutputQuery().setIsFrozen(true).setIsSpent(false));
for (MoneroOutputWallet frozenOutput : frozenOutputs) sum = sum.add(frozenOutput.getAmount());
@ -138,7 +138,7 @@ public class Balances {
}
private void updateReservedTradeBalance() {
BigInteger sum = BigInteger.valueOf(0);
BigInteger sum = BigInteger.ZERO;
List<Trade> trades = tradeManager.getTradesStreamWithFundsLockedIn().collect(Collectors.toList());
for (Trade trade : trades) {
sum = sum.add(trade.getReservedAmount());

View file

@ -424,7 +424,7 @@ public class XmrWalletService {
// create deposit tx
String multisigAddress = trade.getProcessModel().getMultisigAddress();
BigInteger tradeFee = trade instanceof MakerTrade ? trade.getOffer().getMakerFee() : trade.getTakerFee();
BigInteger sendAmount = trade instanceof BuyerTrade ? BigInteger.valueOf(0) : trade.getAmount();
BigInteger sendAmount = trade instanceof BuyerTrade ? BigInteger.ZERO : trade.getAmount();
BigInteger securityDeposit = trade instanceof BuyerTrade ? trade.getBuyerSecurityDepositBeforeMiningFee() : trade.getSellerSecurityDepositBeforeMiningFee();
long time = System.currentTimeMillis();
log.info("Creating deposit tx with multisig address={}", multisigAddress);
@ -449,7 +449,7 @@ public class XmrWalletService {
subaddressIndices.addAll(subaddressIndicesWithExactInput);
}
if (preferredSubaddressIndex != null) {
if (wallet.getBalance(0, preferredSubaddressIndex).compareTo(BigInteger.valueOf(0)) > 0) {
if (wallet.getBalance(0, preferredSubaddressIndex).compareTo(BigInteger.ZERO) > 0) {
subaddressIndices.add(0, preferredSubaddressIndex); // try preferred subaddress first if funded
} else if (reserveExactAmount) {
subaddressIndices.add(preferredSubaddressIndex); // otherwise only try preferred subaddress if using exact output
@ -532,7 +532,7 @@ public class XmrWalletService {
}
// verify unlock height
if (!BigInteger.valueOf(0).equals(tx.getUnlockTime())) throw new RuntimeException("Unlock height must be 0");
if (!BigInteger.ZERO.equals(tx.getUnlockTime())) throw new RuntimeException("Unlock height must be 0");
// verify miner fee
BigInteger feeEstimate = getElevatedFeeEstimate(tx.getWeight());
@ -603,7 +603,7 @@ public class XmrWalletService {
// round up to multiple of quantization mask
BigInteger[] quotientAndRemainder = baseFee.divideAndRemainder(qmask);
BigInteger feeEstimate = qmask.multiply(quotientAndRemainder[0]);
if (quotientAndRemainder[1].compareTo(BigInteger.valueOf(0)) > 0) feeEstimate = feeEstimate.add(qmask);
if (quotientAndRemainder[1].compareTo(BigInteger.ZERO) > 0) feeEstimate = feeEstimate.add(qmask);
return feeEstimate;
}
@ -1105,7 +1105,7 @@ public class XmrWalletService {
}
public List<XmrAddressEntry> getFundedAvailableAddressEntries() {
return getAvailableAddressEntries().stream().filter(addressEntry -> getBalanceForSubaddress(addressEntry.getSubaddressIndex()).compareTo(BigInteger.valueOf(0)) > 0).collect(Collectors.toList());
return getAvailableAddressEntries().stream().filter(addressEntry -> getBalanceForSubaddress(addressEntry.getSubaddressIndex()).compareTo(BigInteger.ZERO) > 0).collect(Collectors.toList());
}
public List<XmrAddressEntry> getAddressEntryListAsImmutableList() {
@ -1147,7 +1147,7 @@ public class XmrWalletService {
//if (tx.getTransfers(new MoneroTransferQuery().setSubaddressIndex(subaddressIndex)).isEmpty()) continue; // TODO monero-project: transfers are occluded by transfers from/to same account, so this will return unused when used
numUnspentOutputs += tx.isConfirmed() ? tx.getOutputsWallet(new MoneroOutputQuery().setAccountIndex(0).setSubaddressIndex(subaddressIndex)).size() : 1; // TODO: monero-project does not provide outputs for unconfirmed txs
}
boolean positiveBalance = wallet.getBalance(0, subaddressIndex).compareTo(BigInteger.valueOf(0)) > 0;
boolean positiveBalance = wallet.getBalance(0, subaddressIndex).compareTo(BigInteger.ZERO) > 0;
if (positiveBalance && numUnspentOutputs == 0) return 1; // outputs do not appear until confirmed and internal transfers are occluded, so report 1 if positive balance
return numUnspentOutputs;
}
@ -1228,7 +1228,7 @@ public class XmrWalletService {
available = Stream.concat(available, getAddressEntries(XmrAddressEntry.Context.ARBITRATOR).stream());
available = Stream.concat(available, getAddressEntries(XmrAddressEntry.Context.OFFER_FUNDING).stream().filter(entry -> !tradeManager.getOpenOfferManager().getOpenOfferById(entry.getOfferId()).isPresent()));
available = Stream.concat(available, getAddressEntries(XmrAddressEntry.Context.TRADE_PAYOUT).stream().filter(entry -> tradeManager.getTrade(entry.getOfferId()) == null || tradeManager.getTrade(entry.getOfferId()).isPayoutUnlocked()));
return available.filter(addressEntry -> getBalanceForSubaddress(addressEntry.getSubaddressIndex()).compareTo(BigInteger.valueOf(0)) > 0);
return available.filter(addressEntry -> getBalanceForSubaddress(addressEntry.getSubaddressIndex()).compareTo(BigInteger.ZERO) > 0);
}
public void addWalletListener(MoneroWalletListenerI listener) {