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? // TODO (woodser): check for invalid maker fee txs with xmr?
// openOfferManager.getObservableList().forEach(e -> { // openOfferManager.getObservableList().forEach(e -> {
// String offerFeePaymentTxId = e.getOffer().getOfferFeePaymentTxId(); // 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", // String message = Res.get("popup.warning.openOfferWithInvalidMakerFeeTx",
// e.getOffer().getShortId(), offerFeePaymentTxId); // e.getOffer().getShortId(), offerFeePaymentTxId);
// log.warn(message); // log.warn(message);

View File

@ -103,7 +103,7 @@ 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() { private void updateAvailableBalance() {
availableBalance.set(Coin.valueOf(xmrWalletService.getWallet().getUnlockedBalance(0).longValue())); availableBalance.set(Coin.valueOf(xmrWalletService.getWallet().getUnlockedBalance(0).longValue()));

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) { public MoneroWallet getOrCreateMultisigWallet(String tradeId) {
String path = "xmr_multisig_trade_" + tradeId; String path = "xmr_multisig_trade_" + tradeId;
MoneroWallet multisigWallet = null; 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 // 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.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. // Default trade limits.
// We initialize very early before reading persisted data. We will apply later the limit from // 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!"); //System.out.println("Creating feeEstimateTx!");
MoneroTxWallet feeEstimateTx = multisigWallet.createTx(new MoneroTxConfig() MoneroTxWallet feeEstimateTx = multisigWallet.createTx(new MoneroTxConfig()
.setAccountIndex(0) .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(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(sellerPayoutAddress, sellerPayoutAmount.multiply(BigInteger.valueOf(4)).divide(BigInteger.valueOf(5)))
.setRelay(false) .setRelay(false)
); );
@ -640,12 +640,11 @@ public final class ArbitrationManager extends DisputeManager<ArbitrationDisputeL
numAttempts++; numAttempts++;
payoutTx = multisigWallet.createTx(new MoneroTxConfig() payoutTx = multisigWallet.createTx(new MoneroTxConfig()
.setAccountIndex(0) .setAccountIndex(0)
.addDestination(new MoneroDestination(buyerPayoutAddress, buyerPayoutAmount.subtract(feeEstimate.divide(BigInteger.valueOf(2))))) // split fee subtracted from each payout amount .addDestination(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(sellerPayoutAddress, sellerPayoutAmount.subtract(feeEstimate.divide(BigInteger.valueOf(2))))
.setRelay(false)); .setRelay(false));
} catch (MoneroError e) { } catch (MoneroError e) {
e.printStackTrace(); // exception expected // TODO: better way of estimating fee?
System.out.println("FAILED TO CREATE PAYOUT TX, ITERATING...");
} }
} }

View File

@ -27,6 +27,6 @@ public class TradeTaskRunner extends TaskRunner<Trade> {
public TradeTaskRunner(Trade sharedModel, ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) { public TradeTaskRunner(Trade sharedModel, ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) {
//noinspection unchecked //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!"); System.out.println("Creating feeEstimateTx!");
MoneroTxWallet feeEstimateTx = multisigWallet.createTx(new MoneroTxConfig() MoneroTxWallet feeEstimateTx = multisigWallet.createTx(new MoneroTxConfig()
.setAccountIndex(0) .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(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(sellerPayoutAddress, sellerPayoutAmount.multiply(BigInteger.valueOf(4)).divide(BigInteger.valueOf(5)))
.setRelay(false) .setRelay(false)
); );

View File

@ -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