cleanup todos and update to new monero-java api

This commit is contained in:
woodser 2021-04-17 14:00:32 -04:00
parent 376f10b7c7
commit 391594198f
8 changed files with 15 additions and 45 deletions

View file

@ -521,7 +521,7 @@ public class BisqSetup {
// TODO (woodser): check for invalid maker fee txs with xmr?
// openOfferManager.getObservableList().forEach(e -> {
// String offerFeePaymentTxId = e.getOffer().getOfferFeePaymentTxId();
// if (btcWalletService.getConfidenceForTxId(offerFeePaymentTxId) == null) { // TODO (woodser): needed for xmr base?
// if (btcWalletService.getConfidenceForTxId(offerFeePaymentTxId) == null) { // TODO (woodser): verify xmr maker fee tx
// String message = Res.get("popup.warning.openOfferWithInvalidMakerFeeTx",
// e.getOffer().getShortId(), offerFeePaymentTxId);
// log.warn(message);

View file

@ -103,10 +103,10 @@ public class Balances {
});
}
// TODO (woodser): reserved balance = reserved for trade, locked balance = locked in multisig
// TODO (woodser): currently reserved balance = reserved for trade (excluding multisig) and locked balance = txs with < 10 confirmations
private void updateAvailableBalance() {
availableBalance.set(Coin.valueOf(xmrWalletService.getWallet().getUnlockedBalance(0).longValue()));
availableBalance.set(Coin.valueOf(xmrWalletService.getWallet().getUnlockedBalance(0).longValue()));
}
private void updateReservedBalance() {
@ -117,7 +117,7 @@ public class Balances {
}
reservedBalance.set(Coin.valueOf(sum.longValue()));
}
private void updateLockedBalance() {
BigInteger balance = xmrWalletService.getWallet().getBalance(0);
BigInteger unlockedBalance = xmrWalletService.getWallet().getUnlockedBalance(0);

View file

@ -91,7 +91,8 @@ public class XmrWalletService {
});
}
// TODO (woodser): move hard-coded values to config
// TODO (woodser): wallet has single password which is passed here?
// TODO (woodser): test retaking failed trade. create new multisig wallet or replace? cannot reuse
public MoneroWallet getOrCreateMultisigWallet(String tradeId) {
String path = "xmr_multisig_trade_" + tradeId;
MoneroWallet multisigWallet = null;

View file

@ -51,7 +51,7 @@ public final class PaymentMethod implements PersistablePayload, Comparable<Payme
// time in blocks (average 10 min for one block confirmation
//private static final long DAY = TimeUnit.HOURS.toMillis(24);
private static final long DAY = TimeUnit.MINUTES.toMillis(1); // TODO (woodser): changed to 1 minute for development
private static final long DAY = TimeUnit.MINUTES.toMillis(1); // TODO (woodser): changed to 1 minute for development, move to config?
// Default trade limits.
// We initialize very early before reading persisted data. We will apply later the limit from

View file

@ -622,8 +622,8 @@ public final class ArbitrationManager extends DisputeManager<ArbitrationDisputeL
//System.out.println("Creating feeEstimateTx!");
MoneroTxWallet feeEstimateTx = multisigWallet.createTx(new MoneroTxConfig()
.setAccountIndex(0)
.addDestination(new MoneroDestination(buyerPayoutAddress, buyerPayoutAmount.multiply(BigInteger.valueOf(4)).divide(BigInteger.valueOf(5)))) // reduce payment amount to compute fee of similar tx
.addDestination(new MoneroDestination(sellerPayoutAddress, sellerPayoutAmount.multiply(BigInteger.valueOf(4)).divide(BigInteger.valueOf(5)))) // TODO (woodser): support addDestination(addr, amt) without new
.addDestination(buyerPayoutAddress, buyerPayoutAmount.multiply(BigInteger.valueOf(4)).divide(BigInteger.valueOf(5))) // reduce payment amount to compute fee of similar tx
.addDestination(sellerPayoutAddress, sellerPayoutAmount.multiply(BigInteger.valueOf(4)).divide(BigInteger.valueOf(5)))
.setRelay(false)
);
@ -640,12 +640,11 @@ public final class ArbitrationManager extends DisputeManager<ArbitrationDisputeL
numAttempts++;
payoutTx = multisigWallet.createTx(new MoneroTxConfig()
.setAccountIndex(0)
.addDestination(new MoneroDestination(buyerPayoutAddress, buyerPayoutAmount.subtract(feeEstimate.divide(BigInteger.valueOf(2))))) // split fee subtracted from each payout amount
.addDestination(new MoneroDestination(sellerPayoutAddress, sellerPayoutAmount.subtract(feeEstimate.divide(BigInteger.valueOf(2))))) // TODO (woodser): support addDestination(addr, amt) without new
.addDestination(buyerPayoutAddress, buyerPayoutAmount.subtract(feeEstimate.divide(BigInteger.valueOf(2)))) // split fee subtracted from each payout amount
.addDestination(sellerPayoutAddress, sellerPayoutAmount.subtract(feeEstimate.divide(BigInteger.valueOf(2))))
.setRelay(false));
} catch (MoneroError e) {
e.printStackTrace();
System.out.println("FAILED TO CREATE PAYOUT TX, ITERATING...");
// exception expected // TODO: better way of estimating fee?
}
}

View file

@ -27,6 +27,6 @@ public class TradeTaskRunner extends TaskRunner<Trade> {
public TradeTaskRunner(Trade sharedModel, ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) {
//noinspection unchecked
super(sharedModel, (Class<Trade>) Trade.class, resultHandler, errorMessageHandler); // TODO (woodser): getSuperClass().getSuperClass(), just to get to Trade.class?
super(sharedModel, (Class<Trade>) Trade.class, resultHandler, errorMessageHandler);
}
}

View file

@ -97,8 +97,8 @@ public class BuyerCreateAndSignPayoutTx extends TradeTask {
System.out.println("Creating feeEstimateTx!");
MoneroTxWallet feeEstimateTx = multisigWallet.createTx(new MoneroTxConfig()
.setAccountIndex(0)
.addDestination(new MoneroDestination(buyerPayoutAddress, buyerPayoutAmount.multiply(BigInteger.valueOf(4)).divide(BigInteger.valueOf(5)))) // reduce payment amount to compute fee of similar tx
.addDestination(new MoneroDestination(sellerPayoutAddress, sellerPayoutAmount.multiply(BigInteger.valueOf(4)).divide(BigInteger.valueOf(5)))) // TODO (woodser): support addDestination(addr, amt) without new
.addDestination(buyerPayoutAddress, buyerPayoutAmount.multiply(BigInteger.valueOf(4)).divide(BigInteger.valueOf(5))) // reduce payment amount to compute fee of similar tx
.addDestination(sellerPayoutAddress, sellerPayoutAmount.multiply(BigInteger.valueOf(4)).divide(BigInteger.valueOf(5)))
.setRelay(false)
);