From 391594198f0f87636ac6d58cb2eefe987585f593 Mon Sep 17 00:00:00 2001 From: woodser Date: Sat, 17 Apr 2021 14:00:32 -0400 Subject: [PATCH] cleanup todos and update to new monero-java api --- .../main/java/bisq/core/app/BisqSetup.java | 2 +- .../src/main/java/bisq/core/btc/Balances.java | 6 ++-- .../core/btc/wallet/XmrWalletService.java | 3 +- .../core/payment/payload/PaymentMethod.java | 2 +- .../arbitration/ArbitrationManager.java | 11 ++++--- .../core/trade/protocol/TradeTaskRunner.java | 2 +- .../buyer/BuyerCreateAndSignPayoutTx.java | 4 +-- todo.txt | 30 ------------------- 8 files changed, 15 insertions(+), 45 deletions(-) delete mode 100644 todo.txt diff --git a/core/src/main/java/bisq/core/app/BisqSetup.java b/core/src/main/java/bisq/core/app/BisqSetup.java index ee212e4f..c697e2f7 100644 --- a/core/src/main/java/bisq/core/app/BisqSetup.java +++ b/core/src/main/java/bisq/core/app/BisqSetup.java @@ -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); diff --git a/core/src/main/java/bisq/core/btc/Balances.java b/core/src/main/java/bisq/core/btc/Balances.java index bb38c1ef..d9247f08 100644 --- a/core/src/main/java/bisq/core/btc/Balances.java +++ b/core/src/main/java/bisq/core/btc/Balances.java @@ -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); diff --git a/core/src/main/java/bisq/core/btc/wallet/XmrWalletService.java b/core/src/main/java/bisq/core/btc/wallet/XmrWalletService.java index eeb79656..47c1c456 100644 --- a/core/src/main/java/bisq/core/btc/wallet/XmrWalletService.java +++ b/core/src/main/java/bisq/core/btc/wallet/XmrWalletService.java @@ -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; diff --git a/core/src/main/java/bisq/core/payment/payload/PaymentMethod.java b/core/src/main/java/bisq/core/payment/payload/PaymentMethod.java index 333b6306..9d51ee69 100644 --- a/core/src/main/java/bisq/core/payment/payload/PaymentMethod.java +++ b/core/src/main/java/bisq/core/payment/payload/PaymentMethod.java @@ -51,7 +51,7 @@ public final class PaymentMethod implements PersistablePayload, Comparable { public TradeTaskRunner(Trade sharedModel, ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) { //noinspection unchecked - super(sharedModel, (Class) Trade.class, resultHandler, errorMessageHandler); // TODO (woodser): getSuperClass().getSuperClass(), just to get to Trade.class? + super(sharedModel, (Class) Trade.class, resultHandler, errorMessageHandler); } } diff --git a/core/src/main/java/bisq/core/trade/protocol/tasks/buyer/BuyerCreateAndSignPayoutTx.java b/core/src/main/java/bisq/core/trade/protocol/tasks/buyer/BuyerCreateAndSignPayoutTx.java index f85f384e..e5bf3169 100644 --- a/core/src/main/java/bisq/core/trade/protocol/tasks/buyer/BuyerCreateAndSignPayoutTx.java +++ b/core/src/main/java/bisq/core/trade/protocol/tasks/buyer/BuyerCreateAndSignPayoutTx.java @@ -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) ); diff --git a/todo.txt b/todo.txt deleted file mode 100644 index ccdfc038..00000000 --- a/todo.txt +++ /dev/null @@ -1,30 +0,0 @@ -configurable daemon for poc -trade removed from books immediately or when taker pays fee? see ProcessOfferAvailabilityResponse -one TraderProtocol which supports maker, taker, buyer, seller methods to prevent duplicate implementations -script to launch local network -use "deposit tx" terminology instead of "fund multisig" -use rpc instead of jni bindings? requires notifications in monero-java -resume listeners on startup (BisqSetup.start() - init multisig?) -finalize protocol (when to remove trade from books, tx ids, no arbitrator till ms?) -deploy seed -balances: total, locked, reserved? -verify payout txs in dispute -user can review/accept/reject arbitrator payout decision -arbitrator fee? -proper error handling -peer verify fee tx -multisig wallets replaced if exist and trade restarted -multisig wallets named with trade id + trade peer id for concurrent acceptance? -use getNewAddressEntry() to register payout destination -use BigIntegers instead of satoshi conversion? -remove bitcoinj dependency? -manage all funds in account 0 with reserved subaddresses or move failed trade account funds to account 0 (incurs miner fee + 10 block wait time) -refactor State/Phase for CleanupTradeableOnFault -temp node address vs trusting/persisitng into trade model -ui designs -flatten ProcessModel into Trade / other model refactors? -might occasionally need to reimburse taker fee if maker does not enter into multisig -test disconnection from daemon at various stages - -BEFORE PRODUCTION -build status like bisq: https://travis-ci.org/bisq-network/bisq \ No newline at end of file