diff --git a/WalletWasabi.Documentation/WasabiSetupRegtest.md b/WalletWasabi.Documentation/WasabiSetupRegtest.md index 75b6187e012..ee107b7305f 100644 --- a/WalletWasabi.Documentation/WasabiSetupRegtest.md +++ b/WalletWasabi.Documentation/WasabiSetupRegtest.md @@ -125,10 +125,10 @@ Todo: `dotnet run --no-build` 5. Generate a wallet in Wasabi named: R1. 6. Generate a receive address in Wasabi, now go to Bitcoin Knots to the Send tab. -7. Send 1 BTC to that address. +7. Send BTC 1 to that address. 8. Generate a wallet in Wasabi named: R2. 9. Generate a receive address in Wasabi, now go to Bitcoin Knots to the Send tab. -10. Send 1 BTC to that address. +10. Send BTC 1 to that address. 11. Now let the coinjoin happen automatically in both wallets. 12. If you see `Waiting for confirmed funds` in the music box you can generate a block in Bitcoin Knots to continue coinjoining. - You can do it with the console command `generatetoaddress 1 ` diff --git a/WalletWasabi.Fluent/Controls/DualCurrencyEntryBox.axaml.cs b/WalletWasabi.Fluent/Controls/DualCurrencyEntryBox.axaml.cs index 7309ed0603e..3f0823f982b 100644 --- a/WalletWasabi.Fluent/Controls/DualCurrencyEntryBox.axaml.cs +++ b/WalletWasabi.Fluent/Controls/DualCurrencyEntryBox.axaml.cs @@ -347,17 +347,17 @@ private decimal FiatToBitcoin(decimal fiatValue) private static string FullFormatBtc(decimal value) { - return $"{value.FormattedBtc()} BTC"; + return $"BTC {value.FormattedBtc()}"; } private static string FullFormatFiat(decimal value, string currencyCode, bool approximate) { var part1 = approximate ? "≈ " : ""; - var part2 = value.FormattedFiat(); - var part3 = + var part2 = !string.IsNullOrWhiteSpace(currencyCode) - ? $" {currencyCode}" + ? $"{currencyCode} " : ""; + var part3 = value.FormattedFiat(); return part1 + part2 + part3; } diff --git a/WalletWasabi.Fluent/Extensions/CurrencyExtensions.cs b/WalletWasabi.Fluent/Extensions/CurrencyExtensions.cs index 854ed05aeda..dee1fe5adc0 100644 --- a/WalletWasabi.Fluent/Extensions/CurrencyExtensions.cs +++ b/WalletWasabi.Fluent/Extensions/CurrencyExtensions.cs @@ -83,7 +83,7 @@ public static decimal BtcToUsd(this Money money, decimal exchangeRate) public static string ToUsdFormatted(this decimal n) { - return ToUsdAmountFormatted(n) + " USD"; + return "USD " + ToUsdAmountFormatted(n); } public static string ToUsdAmountFormatted(this decimal n) @@ -98,7 +98,7 @@ public static string ToUsdAmountFormatted(this decimal n) public static string ToUsd(this decimal n) { - return n.WithFriendlyDecimals() + " USD"; + return "USD " + n.WithFriendlyDecimals(); } public static decimal WithFriendlyDecimals(this double n) @@ -149,7 +149,7 @@ public static string ToFeeDisplayUnitFormattedString(this Money? fee) _ => fee.ToString() }; - var feeText = $"{feePartText} {displayUnit.FriendlyName()}"; + var feeText = $"{displayUnit.FriendlyName()} {feePartText}"; return feeText; } diff --git a/WalletWasabi.Fluent/Helpers/TextHelpers.cs b/WalletWasabi.Fluent/Helpers/TextHelpers.cs index e45b48cf00d..9b6c621f18a 100644 --- a/WalletWasabi.Fluent/Helpers/TextHelpers.cs +++ b/WalletWasabi.Fluent/Helpers/TextHelpers.cs @@ -55,7 +55,7 @@ public static string TimeSpanToFriendlyString(TimeSpan time) public static string ToBtcWithUnit(this Money money, bool fplus = false) { - return money.ToFormattedString(fplus) + " BTC"; + return "BTC " + money.ToFormattedString(fplus); } public static string ToFormattedString(this Money money, bool fplus = false) diff --git a/WalletWasabi.Fluent/Models/TransactionBroadcasterModel.cs b/WalletWasabi.Fluent/Models/TransactionBroadcasterModel.cs index 1c01b864aaa..8563bf9be88 100644 --- a/WalletWasabi.Fluent/Models/TransactionBroadcasterModel.cs +++ b/WalletWasabi.Fluent/Models/TransactionBroadcasterModel.cs @@ -75,7 +75,7 @@ public TransactionBroadcastInfo GetBroadcastInfo(SmartTransaction transaction) var inputAmountString = totalInputValue is null ? "Unknown" - : $"{totalInputValue.ToFormattedString()} BTC"; + : $"BTC {totalInputValue.ToFormattedString()}"; var outputCount = outputAddressAmount.Length; @@ -87,7 +87,7 @@ public TransactionBroadcastInfo GetBroadcastInfo(SmartTransaction transaction) var outputAmountString = totalOutputValue is null ? "Unknown" - : $"{totalOutputValue.ToFormattedString()} BTC"; + : $"BTC {totalOutputValue.ToFormattedString()}"; var networkFee = totalInputValue is null || totalOutputValue is null ? null diff --git a/WalletWasabi.Fluent/Models/Transactions/PrivacySuggestionsModel.cs b/WalletWasabi.Fluent/Models/Transactions/PrivacySuggestionsModel.cs index 4605ed1a58e..0bd1932fb4a 100644 --- a/WalletWasabi.Fluent/Models/Transactions/PrivacySuggestionsModel.cs +++ b/WalletWasabi.Fluent/Models/Transactions/PrivacySuggestionsModel.cs @@ -437,7 +437,7 @@ private string GetDifferenceText(decimal btcDifference) private string GetDifferenceAmountText(decimal btcDifference, decimal fiatDifference) { - return $"{Math.Abs(btcDifference).FormattedBtc()} BTC {Math.Abs(fiatDifference).ToUsdAproxBetweenParens()}"; + return $"BTC {Math.Abs(btcDifference).FormattedBtc()} {Math.Abs(fiatDifference).ToUsdAproxBetweenParens()}"; } private record Parameters(TransactionInfo TransactionInfo, BuildTransactionResult Transaction, bool IncludeSuggestions); diff --git a/WalletWasabi.Fluent/ViewModels/Wallets/Buy/Messages/OfferMessageViewModel.cs b/WalletWasabi.Fluent/ViewModels/Wallets/Buy/Messages/OfferMessageViewModel.cs index a1d975598fc..c924cab9d5c 100644 --- a/WalletWasabi.Fluent/ViewModels/Wallets/Buy/Messages/OfferMessageViewModel.cs +++ b/WalletWasabi.Fluent/ViewModels/Wallets/Buy/Messages/OfferMessageViewModel.cs @@ -25,7 +25,7 @@ public OfferMessageViewModel(ChatMessage message) : base(message) var total = Items.Sum(x => x.TotalPrice); - TotalMessage = $"For a total price of {total} USD."; + TotalMessage = $"For a total price of USD {total}."; UiMessage = "Our offer includes:"; } diff --git a/WalletWasabi.Fluent/ViewModels/Wallets/Buy/Workflows/ShopinBit/1_Initial/CountryStep.cs b/WalletWasabi.Fluent/ViewModels/Wallets/Buy/Workflows/ShopinBit/1_Initial/CountryStep.cs index 3a652722b08..b87746e1566 100644 --- a/WalletWasabi.Fluent/ViewModels/Wallets/Buy/Workflows/ShopinBit/1_Initial/CountryStep.cs +++ b/WalletWasabi.Fluent/ViewModels/Wallets/Buy/Workflows/ShopinBit/1_Initial/CountryStep.cs @@ -33,7 +33,7 @@ public CountryStep(Conversation conversation, IReadOnlyList countries, protected override IEnumerable BotMessages(Conversation conversation) { // Assistant greeting, min order limit - yield return $"Hello, I am your {GetAssistantName(conversation)}.\nFor now, the MINIMUM ORDER VALUE is $1,000 USD and we only accept requests for LEGAL goods or services."; + yield return $"Hello, I am your {GetAssistantName(conversation)}.\nFor now, the MINIMUM ORDER VALUE is USD 1,000 and we only accept requests for LEGAL goods or services."; // Ask for Location yield return "If your order involves shipping, provide the destination country. For non-shipping orders, specify your nationality."; diff --git a/WalletWasabi.Fluent/Views/AddWallet/WelcomePageView.axaml b/WalletWasabi.Fluent/Views/AddWallet/WelcomePageView.axaml index 38c2c830abb..1db0245a493 100644 --- a/WalletWasabi.Fluent/Views/AddWallet/WelcomePageView.axaml +++ b/WalletWasabi.Fluent/Views/AddWallet/WelcomePageView.axaml @@ -236,7 +236,7 @@ - + diff --git a/WalletWasabi.Fluent/Views/TransactionBroadcasting/BroadcastTransactionView.axaml b/WalletWasabi.Fluent/Views/TransactionBroadcasting/BroadcastTransactionView.axaml index 6deabbc4a8c..615e001911c 100644 --- a/WalletWasabi.Fluent/Views/TransactionBroadcasting/BroadcastTransactionView.axaml +++ b/WalletWasabi.Fluent/Views/TransactionBroadcasting/BroadcastTransactionView.axaml @@ -16,11 +16,11 @@ + Content="{Binding InputAmountString, FallbackValue=BTC 0.0001 1234}" /> + Content="{Binding OutputAmountString, FallbackValue=BTC 0.0001 1234}" /> + Content="{Binding FeeString, FallbackValue=BTC 0.0001 1234}" /> diff --git a/WalletWasabi.Fluent/Views/Wallets/Buy/OrderMessagesView.axaml b/WalletWasabi.Fluent/Views/Wallets/Buy/OrderMessagesView.axaml index 7cdfab70325..8c7becfdce3 100644 --- a/WalletWasabi.Fluent/Views/Wallets/Buy/OrderMessagesView.axaml +++ b/WalletWasabi.Fluent/Views/Wallets/Buy/OrderMessagesView.axaml @@ -76,7 +76,7 @@ - + diff --git a/WalletWasabi.Fluent/Views/Wallets/Home/History/Features/CancelTransactionDialogView.axaml b/WalletWasabi.Fluent/Views/Wallets/Home/History/Features/CancelTransactionDialogView.axaml index 807fad7f5d2..ac008c07983 100644 --- a/WalletWasabi.Fluent/Views/Wallets/Home/History/Features/CancelTransactionDialogView.axaml +++ b/WalletWasabi.Fluent/Views/Wallets/Home/History/Features/CancelTransactionDialogView.axaml @@ -16,11 +16,11 @@ diff --git a/WalletWasabi.Fluent/Views/Wallets/Home/History/Features/SpeedUpTransactionDialogView.axaml b/WalletWasabi.Fluent/Views/Wallets/Home/History/Features/SpeedUpTransactionDialogView.axaml index 869980461bc..622b024de18 100644 --- a/WalletWasabi.Fluent/Views/Wallets/Home/History/Features/SpeedUpTransactionDialogView.axaml +++ b/WalletWasabi.Fluent/Views/Wallets/Home/History/Features/SpeedUpTransactionDialogView.axaml @@ -16,11 +16,11 @@ diff --git a/WalletWasabi.Tests/UnitTests/Blockchain/TransactionOutputs/CoinsRegistryTests.cs b/WalletWasabi.Tests/UnitTests/Blockchain/TransactionOutputs/CoinsRegistryTests.cs index ff35f75c1a0..4ada0035ef4 100644 --- a/WalletWasabi.Tests/UnitTests/Blockchain/TransactionOutputs/CoinsRegistryTests.cs +++ b/WalletWasabi.Tests/UnitTests/Blockchain/TransactionOutputs/CoinsRegistryTests.cs @@ -283,9 +283,9 @@ public void UndoTransaction_TransactionAmounts() SmartTransaction tx3; // The transaction has 1 input and 1 output. Money tx0CreditingAmount = Money.Coins(1.0m); - Money expectedTx1Amount = Money.Coins(-0.05m); // 0.05 BTC was spent (on fees). - Money expectedTx2Amount = Money.Coins(-0.15m); // 0.15 BTC was spent (on fees). - Money expectedTx3Amount = Money.Coins(-0.10m); // 0.10 BTC was spent (on fees). + Money expectedTx1Amount = Money.Coins(-0.05m); // BTC 0.05 was spent (on fees). + Money expectedTx2Amount = Money.Coins(-0.15m); // BTC 0.15 was spent (on fees). + Money expectedTx3Amount = Money.Coins(-0.10m); // BTC 0.10 was spent (on fees). // Create and process transaction tx0. { diff --git a/WalletWasabi/Blockchain/TransactionOutputs/SmartCoin.cs b/WalletWasabi/Blockchain/TransactionOutputs/SmartCoin.cs index c673cbd24ba..55c6da5180a 100644 --- a/WalletWasabi/Blockchain/TransactionOutputs/SmartCoin.cs +++ b/WalletWasabi/Blockchain/TransactionOutputs/SmartCoin.cs @@ -12,7 +12,7 @@ namespace WalletWasabi.Blockchain.TransactionOutputs; /// /// An UTXO that knows more. /// -[DebuggerDisplay("{Amount}BTC {Confirmed} {HdPubKey.Label} OutPoint={Coin.Outpoint}")] +[DebuggerDisplay("BTC{Amount} {Confirmed} {HdPubKey.Label} OutPoint={Coin.Outpoint}")] public class SmartCoin : NotifyPropertyChangedBase, IEquatable, IDestination, ISmartCoin { private Height _height; @@ -158,7 +158,7 @@ public bool RefreshAndGetIsBanned() /// public bool IsAvailable() => SpenderTransaction is null && !SpentAccordingToBackend && !CoinJoinInProgress; - public override string ToString() => $"{TransactionId.ToString()[..7]}.. - {Index}, {ScriptPubKey.ToString()[..7]}.. - {Amount} BTC"; + public override string ToString() => $"{TransactionId.ToString()[..7]}.. - {Index}, {ScriptPubKey.ToString()[..7]}.. - BTC {Amount}"; #region EqualityAndComparison diff --git a/WalletWasabi/Blockchain/Transactions/TransactionFactory.cs b/WalletWasabi/Blockchain/Transactions/TransactionFactory.cs index 54475a0450e..f3f28c761e9 100644 --- a/WalletWasabi/Blockchain/Transactions/TransactionFactory.cs +++ b/WalletWasabi/Blockchain/Transactions/TransactionFactory.cs @@ -286,7 +286,7 @@ public TransactionFactory(Network network, KeyManager keyManager, ICoinsView coi var sign = !KeyManager.IsWatchOnly; - Logger.LogDebug($"Built tx: {totalOutgoingAmountNoFee.ToString(fplus: false, trimExcessZero: true)} BTC. Fee: {fee.Satoshi} sats. Vsize: {vSize} vBytes. Fee/Total ratio: {feePercentage:0.#}%. Tx hash: {tx.GetHash()}."); + Logger.LogDebug($"Built tx: BTC {totalOutgoingAmountNoFee.ToString(fplus: false, trimExcessZero: true)}. Fee: {fee.Satoshi} sats. Vsize: {vSize} vBytes. Fee/Total ratio: {feePercentage:0.#}%. Tx hash: {tx.GetHash()}."); return new BuildTransactionResult(smartTransaction, psbt, sign, fee, feePercentage, hdPubKeysWithNewLabels); } diff --git a/WalletWasabi/BuyAnything/BuyAnythingManager.cs b/WalletWasabi/BuyAnything/BuyAnythingManager.cs index f52ebc4992e..f1ab1303ed9 100644 --- a/WalletWasabi/BuyAnything/BuyAnythingManager.cs +++ b/WalletWasabi/BuyAnything/BuyAnythingManager.cs @@ -133,7 +133,7 @@ private async Task CheckUpdateInOrderStatusAsync(ConversationUpdateTrack track, // Remove sending this chat once the UI can handle the track.Invoice and save the track. await SendSystemChatLinesAsync(track, // $"Pay to: {orderCustomFields.Btcpay_PaymentLink}. The invoice expires in 30 minutes", - $"To finalize your order, please pay {invoice.Amount} BTC in 30 minutes, the latest by {(DateTimeOffset.Now + TimeSpan.FromMinutes(30)).ToLocalTime():HH:mm}.", + $"To finalize your order, please pay BTC {invoice.Amount} in 30 minutes, the latest by {(DateTimeOffset.Now + TimeSpan.FromMinutes(30)).ToLocalTime():HH:mm}.", invoice, order.UpdatedAt, ConversationStatus.InvoiceReceived, cancel).ConfigureAwait(false); diff --git a/WalletWasabi/Exceptions/InsufficientBalanceException.cs b/WalletWasabi/Exceptions/InsufficientBalanceException.cs index d543c5c541a..21ed2ae8d32 100644 --- a/WalletWasabi/Exceptions/InsufficientBalanceException.cs +++ b/WalletWasabi/Exceptions/InsufficientBalanceException.cs @@ -4,7 +4,7 @@ namespace WalletWasabi.Exceptions; public class InsufficientBalanceException : Exception { - public InsufficientBalanceException(Money minimum, Money actual) : base($"Needed: {minimum.ToString(false, true)} BTC, got only: {actual.ToString(false, true)} BTC.") + public InsufficientBalanceException(Money minimum, Money actual) : base($"Needed: BTC {minimum.ToString(false, true)}, got only: BTC {actual.ToString(false, true)}.") { Minimum = minimum ?? Money.Zero; Actual = actual ?? Money.Zero; diff --git a/WalletWasabi/Exceptions/TransactionSizeException.cs b/WalletWasabi/Exceptions/TransactionSizeException.cs index 574a18150dd..c30ba3b1814 100644 --- a/WalletWasabi/Exceptions/TransactionSizeException.cs +++ b/WalletWasabi/Exceptions/TransactionSizeException.cs @@ -5,7 +5,7 @@ namespace WalletWasabi.Exceptions; public class TransactionSizeException : Exception { public TransactionSizeException(Money target, Money maximumPossible) - : base($"Transaction size is over the limit, {target.ToString(false, true)} BTC was needed. Currently, the maximum amount you can spend is {maximumPossible.ToString(false, true)} BTC.") + : base($"Transaction size is over the limit, BTC {target.ToString(false, true)} was needed. Currently, the maximum amount you can spend is {maximumPossible.ToString(false, true)} BTC.") { Target = target ?? Money.Zero; MaximumPossible = maximumPossible ?? Money.Zero; diff --git a/WalletWasabi/Helpers/Constants.cs b/WalletWasabi/Helpers/Constants.cs index e2491c4f514..22e05d7ba82 100644 --- a/WalletWasabi/Helpers/Constants.cs +++ b/WalletWasabi/Helpers/Constants.cs @@ -41,7 +41,7 @@ public static class Constants public const int P2shOutputVirtualSize = 32; // https://en.bitcoin.it/wiki/Bitcoin - // There are a maximum of 2,099,999,997,690,000 Bitcoin elements (called satoshis), which are currently most commonly measured in units of 100,000,000 known as BTC. Stated another way, no more than 21 million BTC can ever be created. + // There are a maximum of 2,099,999,997,690,000 Bitcoin elements (called satoshis), which are currently most commonly measured in units of 100,000,000 known as BTC. Stated another way, no more than BTC 21 million can ever be created. public const long MaximumNumberOfSatoshis = 2099999997690000; public const decimal MaximumNumberOfBitcoins = 20999999.9769m; diff --git a/WalletWasabi/WabiSabi/Backend/Rounds/Arena.cs b/WalletWasabi/WabiSabi/Backend/Rounds/Arena.cs index 381fb120070..bfcc53f0ef4 100644 --- a/WalletWasabi/WabiSabi/Backend/Rounds/Arena.cs +++ b/WalletWasabi/WabiSabi/Backend/Rounds/Arena.cs @@ -171,7 +171,7 @@ await foreach (var offendingAlices in CheckTxoSpendStatusAsync(round, cancel).Co MaxSuggestedAmountProvider.StepMaxSuggested(round, false); EndRound(round, EndRoundState.AbortedNotEnoughAlices); - round.LogInfo($"Not enough inputs ({round.InputCount}) in {nameof(Phase.InputRegistration)} phase. The minimum is ({round.Parameters.MinInputCountByRound}). {nameof(round.Parameters.MaxSuggestedAmount)} was '{round.Parameters.MaxSuggestedAmount}' BTC."); + round.LogInfo($"Not enough inputs ({round.InputCount}) in {nameof(Phase.InputRegistration)} phase. The minimum is ({round.Parameters.MinInputCountByRound}). {nameof(round.Parameters.MaxSuggestedAmount)} was BTC '{round.Parameters.MaxSuggestedAmount}'."); } else if (round.IsInputRegistrationEnded(round.Parameters.MaxInputCountByRound)) { @@ -327,7 +327,7 @@ private async Task StepTransactionSigningPhaseAsync(CancellationToken cancellati round.LogInfo("Trying to broadcast coinjoin."); Coin[] spentCoins = round.CoinjoinState.Inputs.ToArray(); Money networkFee = coinjoin.GetFee(spentCoins); - round.LogInfo($"Network Fee: {networkFee.ToString(false, false)} BTC."); + round.LogInfo($"Network Fee: BTC {networkFee.ToString(false, false)}."); uint256 roundId = round.Id; FeeRate feeRate = coinjoin.GetFeeRate(spentCoins); round.LogInfo($"Network Fee Rate: {feeRate.SatoshiPerByte} sat/vByte."); @@ -571,9 +571,9 @@ private async Task CreateRoundsAsync(CancellationToken cancellationToken) if (foundLargeRound is null) { - largeRound.LogInfo($"Mined round with parameters: {nameof(largeRound.Parameters.MaxSuggestedAmount)}:'{largeRound.Parameters.MaxSuggestedAmount}' BTC."); + largeRound.LogInfo($"Mined round with parameters: BTC {nameof(largeRound.Parameters.MaxSuggestedAmount)}:'{largeRound.Parameters.MaxSuggestedAmount}'."); } - smallRound.LogInfo($"Mined round with parameters: {nameof(smallRound.Parameters.MaxSuggestedAmount)}:'{smallRound.Parameters.MaxSuggestedAmount}' BTC."); + smallRound.LogInfo($"Mined round with parameters: BTC {nameof(smallRound.Parameters.MaxSuggestedAmount)}:'{smallRound.Parameters.MaxSuggestedAmount}'."); // If it can't create the large round, then don't abort. EndRound(round, EndRoundState.AbortedLoadBalancing); diff --git a/WalletWasabi/WabiSabi/Client/Batching/PaymentBatch.cs b/WalletWasabi/WabiSabi/Client/Batching/PaymentBatch.cs index 52e4c2067ef..1d0d5e4aebf 100644 --- a/WalletWasabi/WabiSabi/Client/Batching/PaymentBatch.cs +++ b/WalletWasabi/WabiSabi/Client/Batching/PaymentBatch.cs @@ -32,7 +32,7 @@ public Guid AddPayment(IDestination destination, Money amount) { _payments.Add(payment); } - Logger.LogInfo($"Payment {payment.Id} for {payment.Amount} BTC to {payment.Destination.ScriptPubKey}."); + Logger.LogInfo($"Payment {payment.Id} for BTC {payment.Amount} to {payment.Destination.ScriptPubKey}."); return payment.Id; } @@ -130,7 +130,7 @@ private static void LogPaymentSetDetails(PaymentSet paymentSet) Logger.LogInfo($"Best payment set contains {paymentSet.PaymentCount} payments."); foreach (var payment in paymentSet.Payments) { - Logger.LogInfo($"Id {payment.Id} to {payment.Destination.ScriptPubKey} {payment.Amount.ToDecimal(MoneyUnit.BTC)} BTC."); + Logger.LogInfo($"Id {payment.Id} to {payment.Destination.ScriptPubKey} BTC {payment.Amount.ToDecimal(MoneyUnit.BTC)}."); } } } diff --git a/WalletWasabi/WabiSabi/Client/CoinJoin/Client/CoinJoinClient.cs b/WalletWasabi/WabiSabi/Client/CoinJoin/Client/CoinJoinClient.cs index 5736c8c5f30..0506554bf21 100644 --- a/WalletWasabi/WabiSabi/Client/CoinJoin/Client/CoinJoinClient.cs +++ b/WalletWasabi/WabiSabi/Client/CoinJoin/Client/CoinJoinClient.cs @@ -187,7 +187,7 @@ public async Task StartCoinJoinAsync(Func c.Amount))} BTC."); + throw new CoinJoinClientException(CoinjoinError.NoCoinsEligibleToMix, $"No coin was selected from '{coinCandidates.Count()}' number of coins. Probably it was not economical, total amount of coins were: BTC {Money.Satoshis(coinCandidates.Sum(c => c.Amount))}."); } // Keep going to blame round until there's none, so CJs won't be DDoS-ed. diff --git a/WalletWasabi/WabiSabi/Client/CoinJoin/Client/CoinJoinCoinSelector.cs b/WalletWasabi/WabiSabi/Client/CoinJoin/Client/CoinJoinCoinSelector.cs index cb16f9365e6..80277034063 100644 --- a/WalletWasabi/WabiSabi/Client/CoinJoin/Client/CoinJoinCoinSelector.cs +++ b/WalletWasabi/WabiSabi/Client/CoinJoin/Client/CoinJoinCoinSelector.cs @@ -86,10 +86,10 @@ public ImmutableList SelectCoinsForRound(IEnumerable coins, } Logger.LogDebug($"Coin selection started:"); - Logger.LogDebug($"{nameof(filteredCoins)}: {filteredCoins.Length} coins, valued at {Money.Satoshis(filteredCoins.Sum(x => x.Amount)).ToString(false, true)} BTC."); - Logger.LogDebug($"{nameof(privateCoins)}: {privateCoins.Length} coins, valued at {Money.Satoshis(privateCoins.Sum(x => x.Amount)).ToString(false, true)} BTC."); - Logger.LogDebug($"{nameof(semiPrivateCoins)}: {semiPrivateCoins.Length} coins, valued at {Money.Satoshis(semiPrivateCoins.Sum(x => x.Amount)).ToString(false, true)} BTC."); - Logger.LogDebug($"{nameof(redCoins)}: {redCoins.Length} coins, valued at {Money.Satoshis(redCoins.Sum(x => x.Amount)).ToString(false, true)} BTC."); + Logger.LogDebug($"{nameof(filteredCoins)}: {filteredCoins.Length} coins, valued at BTC {Money.Satoshis(filteredCoins.Sum(x => x.Amount)).ToString(false, true)}."); + Logger.LogDebug($"{nameof(privateCoins)}: {privateCoins.Length} coins, valued at BTC {Money.Satoshis(privateCoins.Sum(x => x.Amount)).ToString(false, true)}."); + Logger.LogDebug($"{nameof(semiPrivateCoins)}: {semiPrivateCoins.Length} coins, valued at BTC {Money.Satoshis(semiPrivateCoins.Sum(x => x.Amount)).ToString(false, true)}."); + Logger.LogDebug($"{nameof(redCoins)}: {redCoins.Length} coins, valued at BTC {Money.Satoshis(redCoins.Sum(x => x.Amount)).ToString(false, true)}."); // We want to isolate red coins from each other. We only let a single red coin get into our selection candidates. var allowedNonPrivateCoins = semiPrivateCoins.ToList(); @@ -97,10 +97,10 @@ public ImmutableList SelectCoinsForRound(IEnumerable coins, if (red is not null) { allowedNonPrivateCoins.Add(red); - Logger.LogDebug($"One red coin got selected: {red.Amount.ToString(false, true)} BTC. Isolating the rest."); + Logger.LogDebug($"One red coin got selected: BTC {red.Amount.ToString(false, true)}. Isolating the rest."); } - Logger.LogDebug($"{nameof(allowedNonPrivateCoins)}: {allowedNonPrivateCoins.Count} coins, valued at {Money.Satoshis(allowedNonPrivateCoins.Sum(x => x.Amount)).ToString(false, true)} BTC."); + Logger.LogDebug($"{nameof(allowedNonPrivateCoins)}: {allowedNonPrivateCoins.Count} coins, valued at BTC {Money.Satoshis(allowedNonPrivateCoins.Sum(x => x.Amount)).ToString(false, true)}."); int inputCount = Math.Min( privateCoins.Length + allowedNonPrivateCoins.Count, @@ -119,10 +119,10 @@ public ImmutableList SelectCoinsForRound(IEnumerable coins, // Let's allow only inputCount - 1 private coins to play. var allowedPrivateCoins = smallerPrivateCoins.Concat(largerPrivateCoins).Take(inputCount - 1).ToArray(); - Logger.LogDebug($"{nameof(allowedPrivateCoins)}: {allowedPrivateCoins.Length} coins, valued at {Money.Satoshis(allowedPrivateCoins.Sum(x => x.Amount)).ToString(false, true)} BTC."); + Logger.LogDebug($"{nameof(allowedPrivateCoins)}: {allowedPrivateCoins.Length} coins, valued at BTC {Money.Satoshis(allowedPrivateCoins.Sum(x => x.Amount)).ToString(false, true)}."); var allowedCoins = allowedNonPrivateCoins.Concat(allowedPrivateCoins).ToArray(); - Logger.LogDebug($"{nameof(allowedCoins)}: {allowedCoins.Length} coins, valued at {Money.Satoshis(allowedCoins.Sum(x => x.Amount)).ToString(false, true)} BTC."); + Logger.LogDebug($"{nameof(allowedCoins)}: {allowedCoins.Length} coins, valued at BTC {Money.Satoshis(allowedCoins.Sum(x => x.Amount)).ToString(false, true)}."); // Shuffle coins, while randomly biasing towards lower AS. var orderedAllowedCoins = AnonScoreTxSourceBiasedShuffle(allowedCoins).ToArray(); @@ -132,7 +132,7 @@ public ImmutableList SelectCoinsForRound(IEnumerable coins, .OrderByDescending(x => x.Amount) .Take(3) .ToArray(); - Logger.LogDebug($"Largest non-private coins: {string.Join(", ", largestNonPrivateCoins.Select(x => x.Amount.ToString(false, true)).ToArray())} BTC."); + Logger.LogDebug($"Largest non-private coins: BTC {string.Join(", ", largestNonPrivateCoins.Select(x => x.Amount.ToString(false, true)).ToArray())}."); // Select a group of coins those are close to each other by anonymity score. Dictionary> groups = new(); @@ -181,7 +181,7 @@ public ImmutableList SelectCoinsForRound(IEnumerable coins, Logger.LogDebug($"Filtered combinations down to {nameof(bestRepGroups)}: {bestRepGroups.Count()}."); var remainingLargestNonPrivateCoins = largestNonPrivateCoins.Where(x => bestRepGroups.Any(y => y.Contains(x))); - Logger.LogDebug($"Remaining largest non-private coins: {string.Join(", ", remainingLargestNonPrivateCoins.Select(x => x.Amount.ToString(false, true)).ToArray())} BTC."); + Logger.LogDebug($"Remaining largest non-private coins: BTC {string.Join(", ", remainingLargestNonPrivateCoins.Select(x => x.Amount.ToString(false, true)).ToArray())}."); // Bias selection towards larger numbers. var selectedNonPrivateCoin = remainingLargestNonPrivateCoins.RandomElement(Rnd); // Select randomly at first just to have a starting value. @@ -208,7 +208,7 @@ public ImmutableList SelectCoinsForRound(IEnumerable coins, Logger.LogDebug($"Couldn't select final selection candidate, ending."); return ImmutableList.Empty; } - Logger.LogDebug($"Selected the final selection candidate: {finalCandidate.Count()} coins, {string.Join(", ", finalCandidate.Select(x => x.Amount.ToString(false, true)).ToArray())} BTC."); + Logger.LogDebug($"Selected the final selection candidate: {finalCandidate.Count()} coins, BTC {string.Join(", ", finalCandidate.Select(x => x.Amount.ToString(false, true)).ToArray())}."); // Let's remove some coins coming from the same tx in the final candidate: // The smaller our balance is the more privacy we gain and the more the user cares about the costs, so more interconnectedness allowance makes sense. @@ -230,7 +230,7 @@ public ImmutableList SelectCoinsForRound(IEnumerable coins, { percent = 50; } - else if (toRegister < 100_000_000) // 1 BTC + else if (toRegister < 100_000_000) // BTC 1 { percent = 60; } @@ -306,7 +306,7 @@ public ImmutableList SelectCoinsForRound(IEnumerable coins, { Logger.LogDebug($"Optimizing selection, removing coins coming from the same tx."); Logger.LogDebug($"{nameof(sameTxAllowance)}: {sameTxAllowance}."); - Logger.LogDebug($"{nameof(winner)}: {winner.Count} coins, {string.Join(", ", winner.Select(x => x.Amount.ToString(false, true)).ToArray())} BTC."); + Logger.LogDebug($"{nameof(winner)}: {winner.Count} coins, BTC {string.Join(", ", winner.Select(x => x.Amount.ToString(false, true)).ToArray())}."); } if (winner.Count < MaxInputsRegistrableByWallet)