diff --git a/apitest/scripts/trade-simulation-utils.sh b/apitest/scripts/trade-simulation-utils.sh index c43beaf2ec..6b14622261 100755 --- a/apitest/scripts/trade-simulation-utils.sh +++ b/apitest/scripts/trade-simulation-utils.sh @@ -458,7 +458,7 @@ delayconfirmpaymentreceived() { } # This is a large function that should be broken up if it ever makes sense to not treat a trade -# execution simulation as an atomic operation. But we are not testing api methods here, just +# execution simulation as an bsq swap operation. But we are not testing api methods here, just # demonstrating how to use them to get through the trade protocol. It should work for any trade # between Bob & Alice, as long as Alice is maker, Bob is taker, and the offer to be taken is the # first displayed in Bob's getoffers command output. diff --git a/core/src/main/java/bisq/core/api/CoreTradesService.java b/core/src/main/java/bisq/core/api/CoreTradesService.java index b9fd534c09..80fd6f6ca0 100644 --- a/core/src/main/java/bisq/core/api/CoreTradesService.java +++ b/core/src/main/java/bisq/core/api/CoreTradesService.java @@ -100,7 +100,7 @@ class CoreTradesService { throw new IllegalArgumentException(format("payment account with id '%s' not found", paymentAccountId)); var useSavingsWallet = true; - //noinspection ConstantConditions + takeOfferModel.initModel(offer, paymentAccount, useSavingsWallet); log.info("Initiating take {} offer, {}", offer.isBuyOffer() ? "buy" : "sell", diff --git a/core/src/main/java/bisq/core/api/CoreWalletsService.java b/core/src/main/java/bisq/core/api/CoreWalletsService.java index 54f841e125..5c023cd487 100644 --- a/core/src/main/java/bisq/core/api/CoreWalletsService.java +++ b/core/src/main/java/bisq/core/api/CoreWalletsService.java @@ -82,7 +82,6 @@ import lombok.extern.slf4j.Slf4j; import javax.annotation.Nullable; -import static bisq.common.config.BaseCurrencyNetwork.BTC_DAO_REGTEST; import static bisq.core.btc.wallet.Restrictions.getMinNonDustOutput; import static bisq.core.util.ParsingUtils.parseToCoin; import static java.lang.String.format; diff --git a/core/src/main/java/bisq/core/btc/TxFeeEstimationService.java b/core/src/main/java/bisq/core/btc/TxFeeEstimationService.java index 1cf1d07cd4..049b4a4d5f 100644 --- a/core/src/main/java/bisq/core/btc/TxFeeEstimationService.java +++ b/core/src/main/java/bisq/core/btc/TxFeeEstimationService.java @@ -55,11 +55,11 @@ public class TxFeeEstimationService { // segwit deposit tx with change vsize = 263 // segwit payout tx vsize = 169 // segwit delayed payout tx vsize = 139 - public static int TYPICAL_TX_WITH_1_INPUT_VSIZE = 175; - private static int DEPOSIT_TX_VSIZE = 233; +public static final int TYPICAL_TX_WITH_1_INPUT_VSIZE = 175; + private static final int DEPOSIT_TX_VSIZE = 233; - private static int BSQ_INPUT_INCREASE = 70; - private static int MAX_ITERATIONS = 10; + private static final int BSQ_INPUT_INCREASE = 70; + private static final int MAX_ITERATIONS = 10; private final FeeService feeService; private final BtcWalletService btcWalletService; diff --git a/core/src/main/java/bisq/core/btc/wallet/TradeWalletService.java b/core/src/main/java/bisq/core/btc/wallet/TradeWalletService.java index 94d6e75cf3..79eef4805c 100644 --- a/core/src/main/java/bisq/core/btc/wallet/TradeWalletService.java +++ b/core/src/main/java/bisq/core/btc/wallet/TradeWalletService.java @@ -1077,14 +1077,14 @@ public class TradeWalletService { /////////////////////////////////////////////////////////////////////////////////////////// public Tuple2 emergencyBuildPayoutTxFrom2of2MultiSig(String depositTxHex, - Coin buyerPayoutAmount, - Coin sellerPayoutAmount, - Coin txFee, - String buyerAddressString, - String sellerAddressString, - String buyerPubKeyAsHex, - String sellerPubKeyAsHex, - boolean hashedMultiSigOutputIsLegacy) { + Coin buyerPayoutAmount, + Coin sellerPayoutAmount, + Coin txFee, + String buyerAddressString, + String sellerAddressString, + String buyerPubKeyAsHex, + String sellerPubKeyAsHex, + boolean hashedMultiSigOutputIsLegacy) { byte[] buyerPubKey = ECKey.fromPublicOnly(Utils.HEX.decode(buyerPubKeyAsHex)).getPubKey(); byte[] sellerPubKey = ECKey.fromPublicOnly(Utils.HEX.decode(sellerPubKeyAsHex)).getPubKey(); Script redeemScript = get2of2MultiSigRedeemScript(buyerPubKey, sellerPubKey); @@ -1105,7 +1105,10 @@ public class TradeWalletService { return new Tuple2<>(redeemScriptHex, unsignedTxHex); } - public String emergencyGenerateSignature(String rawTxHex, String redeemScriptHex, Coin inputValue, String myPrivKeyAsHex) + public String emergencyGenerateSignature(String rawTxHex, + String redeemScriptHex, + Coin inputValue, + String myPrivKeyAsHex) throws IllegalArgumentException { boolean hashedMultiSigOutputIsLegacy = true; if (rawTxHex.startsWith("010000000001")) @@ -1129,10 +1132,10 @@ public class TradeWalletService { } public Tuple2 emergencyApplySignatureToPayoutTxFrom2of2MultiSig(String unsignedTxHex, - String redeemScriptHex, - String buyerSignatureAsHex, - String sellerSignatureAsHex, - boolean hashedMultiSigOutputIsLegacy) + String redeemScriptHex, + String buyerSignatureAsHex, + String sellerSignatureAsHex, + boolean hashedMultiSigOutputIsLegacy) throws AddressFormatException, SignatureDecodeException { Transaction payoutTx = new Transaction(params, Utils.HEX.decode(unsignedTxHex)); TransactionSignature buyerTxSig = TransactionSignature.decodeFromBitcoin(Utils.HEX.decode(buyerSignatureAsHex), true, true); diff --git a/core/src/main/java/bisq/core/btc/wallet/WalletService.java b/core/src/main/java/bisq/core/btc/wallet/WalletService.java index 178aa5fc32..6d92dde77a 100644 --- a/core/src/main/java/bisq/core/btc/wallet/WalletService.java +++ b/core/src/main/java/bisq/core/btc/wallet/WalletService.java @@ -818,6 +818,7 @@ public abstract class WalletService { return maybeAddTxToWallet(transaction.bitcoinSerialize(), wallet, source); } + /////////////////////////////////////////////////////////////////////////////////////////// // bisqWalletEventListener /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/core/src/main/java/bisq/core/trade/protocol/bisq_v1/tasks/buyer/BuyerProcessPayoutTxPublishedMessage.java b/core/src/main/java/bisq/core/trade/protocol/bisq_v1/tasks/buyer/BuyerProcessPayoutTxPublishedMessage.java index b21ac8be95..e01e118fcd 100644 --- a/core/src/main/java/bisq/core/trade/protocol/bisq_v1/tasks/buyer/BuyerProcessPayoutTxPublishedMessage.java +++ b/core/src/main/java/bisq/core/trade/protocol/bisq_v1/tasks/buyer/BuyerProcessPayoutTxPublishedMessage.java @@ -44,7 +44,6 @@ public class BuyerProcessPayoutTxPublishedMessage extends TradeTask { protected void run() { try { runInterceptHook(); - log.debug("current trade state " + trade.getState()); PayoutTxPublishedMessage message = (PayoutTxPublishedMessage) processModel.getTradeMessage(); Validator.checkTradeId(processModel.getOfferId(), message); checkNotNull(message); diff --git a/desktop/src/main/java/bisq/desktop/main/dao/bonding/reputation/MyReputationView.java b/desktop/src/main/java/bisq/desktop/main/dao/bonding/reputation/MyReputationView.java index 764d073abb..ae051a2410 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/bonding/reputation/MyReputationView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/bonding/reputation/MyReputationView.java @@ -38,8 +38,8 @@ import bisq.core.dao.governance.bond.BondState; import bisq.core.dao.governance.bond.reputation.MyBondedReputation; import bisq.core.locale.Res; import bisq.core.user.Preferences; -import bisq.core.util.coin.BsqFormatter; import bisq.core.util.ParsingUtils; +import bisq.core.util.coin.BsqFormatter; import bisq.core.util.validation.HexStringValidator; import bisq.core.util.validation.IntegerValidator; diff --git a/desktop/src/main/java/bisq/desktop/main/offer/bisq_v1/OfferViewModelUtil.java b/desktop/src/main/java/bisq/desktop/main/offer/bisq_v1/OfferViewModelUtil.java index 0ad3f0e4d8..6ce76791dd 100644 --- a/desktop/src/main/java/bisq/desktop/main/offer/bisq_v1/OfferViewModelUtil.java +++ b/desktop/src/main/java/bisq/desktop/main/offer/bisq_v1/OfferViewModelUtil.java @@ -32,6 +32,7 @@ import org.bitcoinj.core.Coin; import java.util.Optional; +// Shared utils for ViewModels public class OfferViewModelUtil { public static String getTradeFeeWithFiatEquivalent(OfferUtil offerUtil, Coin tradeFee, @@ -66,8 +67,8 @@ public class OfferViewModelUtil { " " + Res.get("guiUtil.ofTradeAmount"); } return offerUtil.getFeeInUserFiatCurrency(tradeFee, - isCurrencyForMakerFeeBtc, - formatter) + isCurrencyForMakerFeeBtc, + formatter) .map(VolumeUtil::formatAverageVolumeWithCode) .map(feeInFiat -> Res.get("feeOptionWindow.btcFeeWithFiatAndPercentage", feeAsBtc, feeInFiat, percentage)) .orElseGet(() -> Res.get("feeOptionWindow.btcFeeWithPercentage", feeAsBtc, percentage));