mirror of
https://github.com/bisq-network/bisq.git
synced 2025-01-19 05:44:05 +01:00
Cleanups, refromatting, add final qualifier
This commit is contained in:
parent
25bbad1f9c
commit
777287af95
@ -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.
|
||||
|
@ -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",
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -818,6 +818,7 @@ public abstract class WalletService {
|
||||
return maybeAddTxToWallet(transaction.bitcoinSerialize(), wallet, source);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// bisqWalletEventListener
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user