Cleanups, refromatting, add final qualifier

This commit is contained in:
chimp1984 2021-10-20 00:11:36 +02:00
parent 25bbad1f9c
commit 777287af95
No known key found for this signature in database
GPG Key ID: 9801B4EC591F90E3
9 changed files with 27 additions and 24 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -1077,14 +1077,14 @@ public class TradeWalletService {
///////////////////////////////////////////////////////////////////////////////////////////
public Tuple2<String, String> 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<String, String> 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);

View File

@ -818,6 +818,7 @@ public abstract class WalletService {
return maybeAddTxToWallet(transaction.bitcoinSerialize(), wallet, source);
}
///////////////////////////////////////////////////////////////////////////////////////////
// bisqWalletEventListener
///////////////////////////////////////////////////////////////////////////////////////////

View File

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

View File

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

View File

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