User min 2sat/b to correct rounding errrors.
MODIFY
WalletWasabi.Backend/Controllers/BlockchainController.cs
WalletWasabi.Backend/Controllers/BlockchainController.cs
@@ -77,7 +77,7 @@ namespace WalletWasabi.Backend.Controllers
foreach (int target in confirmationTargetsInts)
{
- // 1. Use the sanity check that under 1 satoshi per bytes should not be displayed.
+ // 1. Use the sanity check that under 2 satoshi per bytes should not be displayed. To correct possible rounding errors.
// 2. Use the RPCResponse.Blocks output to avoid redundant RPC queries.
// 3. Use caching.
var conservativeResponse = await GetEstimateSmartFeeAsync(target, EstimateSmartFeeMode.Conservative);
@@ -85,8 +85,8 @@ namespace WalletWasabi.Backend.Controllers
var conservativeFee = conservativeResponse.FeeRate.FeePerK.Satoshi / 1000;
var economicalFee = economicalResponse.FeeRate.FeePerK.Satoshi / 1000;
- conservativeFee = Math.Max(conservativeFee, 1);
- economicalFee = Math.Max(economicalFee, 1);
+ conservativeFee = Math.Max(conservativeFee, 2);
+ economicalFee = Math.Max(economicalFee, 2);
feeEstimations.Add(target, new FeeEstimationPair() { Conservative = conservativeFee, Economical = economicalFee });
}

MODIFY
WalletWasabi.Tests/RegTests.cs
WalletWasabi.Tests/RegTests.cs
@@ -736,7 +736,7 @@ namespace WalletWasabi.Tests
Assert.Single(res2.OuterWalletOutputs);
Assert.Equal(scp, res2.OuterWalletOutputs.Single().ScriptPubKey);
Assert.Single(res2.InnerWalletOutputs);
- Assert.True(res2.Fee > new Money(1 * 100)); // since there is a sanity check of 1sat/b in the server
+ Assert.True(res2.Fee > new Money(2 * 100)); // since there is a sanity check of 2sat/vb in the server
Assert.InRange(res2.FeePercentOfSent, 0, 1);
Assert.Single(res2.SpentCoins);
Assert.Equal(key.GetP2wpkhScript(), res2.SpentCoins.Single().ScriptPubKey);

MODIFY
WalletWasabi/Services/WalletService.cs
WalletWasabi/Services/WalletService.cs
@@ -794,7 +794,9 @@ namespace WalletWasabi.Services
using (var client = new WasabiClient(IndexDownloader.WasabiClient.TorClient.DestinationUri, IndexDownloader.WasabiClient.TorClient.TorSocks5EndPoint))
{
var fees = await client.GetFeesAsync(feeTarget);
- feePerBytes = new Money(fees.Single().Value.Conservative);
+ Money feeRate = fees.Single().Value.Conservative;
+ Money sanityCheckedFeeRate = Math.Max(feeRate, 2); // Use the sanity check that under 2 satoshi per bytes should not be displayed. To correct possible rounding errors.
+ feePerBytes = new Money(sanityCheckedFeeRate);
}
bool spendAll = spendAllCount == 1;
@@ -815,9 +817,9 @@ namespace WalletWasabi.Services
var origTxSize = inNum * Constants.P2pkhInputSizeInBytes + outNum * Constants.OutputSizeInBytes + 10;
var newTxSize = inNum * Constants.P2wpkhInputSizeInBytes + outNum * Constants.OutputSizeInBytes + 10; // BEWARE: This assumes segwit only inputs!
var vSize = (int)Math.Ceiling(((3 * newTxSize) + origTxSize) / 4m);
- Logger.LogInfo<WalletService>($"Estimated tx size: {vSize} bytes.");
+ Logger.LogInfo<WalletService>($"Estimated tx size: {vSize} vbytes.");
Money fee = feePerBytes * vSize;
- Logger.LogInfo<WalletService>($"Fee: {fee.ToString(fplus: false, trimExcessZero: true)}");
+ Logger.LogInfo<WalletService>($"Fee: {fee.Satoshi} Satoshi");
// 5. How much to spend?
long toSendAmountSumInSatoshis = toSend.Select(x => x.Amount).Sum(); // Does it work if I simply go with Money class here? Is that copied by reference of value?
@@ -890,7 +892,7 @@ namespace WalletWasabi.Services
{
Logger.LogInfo<WalletService>($"The transaction fee is {feePc:0.#}% of your transaction amount."
+ Environment.NewLine + $"Sending:\t {totalOutgoingAmount.ToString(fplus: false, trimExcessZero: true)} BTC."
- + Environment.NewLine + $"Fee:\t\t {fee.ToString(fplus: false, trimExcessZero: true)} BTC.");
+ + Environment.NewLine + $"Fee:\t\t {fee.Satoshi} Satoshi.");
}
if (feePc > 100)
{

User min 2sat/b to correct rounding errrors.