Remove more code
MODIFY
WalletWasabi.Backend/Controllers/BlockchainController.cs
WalletWasabi.Backend/Controllers/BlockchainController.cs
@@ -78,7 +78,7 @@ namespace WalletWasabi.Backend.Controllers
return await Cache.AtomicGetOrCreateAsync(
cacheKey,
cacheOptions,
- () => RpcClient.EstimateAllFeeAsync(mode, simulateIfRegTest: true, tolerateBitcoinCoreBrainfuck: true));
+ () => RpcClient.EstimateAllFeeAsync(mode, simulateIfRegTest: true));
}
/// <summary>

MODIFY
WalletWasabi.Tests/RegressionTests/CoinJoinTests.cs
WalletWasabi.Tests/RegressionTests/CoinJoinTests.cs
@@ -1050,7 +1050,7 @@ namespace WalletWasabi.Tests.RegressionTests
}
FeeRate feeRateTx = finalCoinjoin.GetFeeRate(coins.ToArray());
- var esr = await rpc.EstimateSmartFeeAsync(roundConfig.ConfirmationTarget, EstimateSmartFeeMode.Conservative, simulateIfRegTest: true, tryOtherFeeRates: true);
+ var esr = await rpc.EstimateSmartFeeAsync(roundConfig.ConfirmationTarget, EstimateSmartFeeMode.Conservative, simulateIfRegTest: true);
FeeRate feeRateReal = esr.FeeRate;
Assert.True(feeRateReal.FeePerK - feeRateReal.FeePerK / 2 < feeRateTx.FeePerK); // Max 50% mistake.

MODIFY
WalletWasabi.Tests/UnitTests/BitcoinCore/RpcBasedTests.cs
WalletWasabi.Tests/UnitTests/BitcoinCore/RpcBasedTests.cs
@@ -158,17 +158,12 @@ namespace WalletWasabi.Tests.UnitTests.BitcoinCore
try
{
var rpc = coreNode.RpcClient;
- var estimations = await rpc.EstimateAllFeeAsync(EstimateSmartFeeMode.Conservative, simulateIfRegTest: true, tolerateBitcoinCoreBrainfuck: true);
+ var estimations = await rpc.EstimateAllFeeAsync(EstimateSmartFeeMode.Conservative, simulateIfRegTest: true);
Assert.Equal(WalletWasabi.Helpers.Constants.OneDayConfirmationTarget, estimations.Estimations.Count);
Assert.True(estimations.Estimations.First().Key < estimations.Estimations.Last().Key);
Assert.True(estimations.Estimations.First().Value > estimations.Estimations.Last().Value);
Assert.Equal(EstimateSmartFeeMode.Conservative, estimations.Type);
- estimations = await rpc.EstimateAllFeeAsync(EstimateSmartFeeMode.Economical, simulateIfRegTest: true, tolerateBitcoinCoreBrainfuck: true);
- Assert.Equal(145, estimations.Estimations.Count);
- Assert.True(estimations.Estimations.First().Key < estimations.Estimations.Last().Key);
- Assert.True(estimations.Estimations.First().Value > estimations.Estimations.Last().Value);
- Assert.Equal(EstimateSmartFeeMode.Economical, estimations.Type);
- estimations = await rpc.EstimateAllFeeAsync(EstimateSmartFeeMode.Economical, simulateIfRegTest: true, tolerateBitcoinCoreBrainfuck: false);
+ estimations = await rpc.EstimateAllFeeAsync(EstimateSmartFeeMode.Economical, simulateIfRegTest: true);
Assert.Equal(145, estimations.Estimations.Count);
Assert.True(estimations.Estimations.First().Key < estimations.Estimations.Last().Key);
Assert.True(estimations.Estimations.First().Value > estimations.Estimations.Last().Value);

MODIFY
WalletWasabi/BitcoinCore/Monitoring/RpcFeeProvider.cs
WalletWasabi/BitcoinCore/Monitoring/RpcFeeProvider.cs
@@ -39,7 +39,7 @@ namespace WalletWasabi.BitcoinCore.Monitoring
{
try
{
- var allFeeEstimate = await RpcClient.EstimateAllFeeAsync(EstimateSmartFeeMode.Conservative, true, true).ConfigureAwait(false);
+ var allFeeEstimate = await RpcClient.EstimateAllFeeAsync(EstimateSmartFeeMode.Conservative, true).ConfigureAwait(false);
AllFeeEstimate = allFeeEstimate;
}
catch

MODIFY
WalletWasabi/CoinJoin/Coordinator/Rounds/CoordinatorRound.cs
WalletWasabi/CoinJoin/Coordinator/Rounds/CoordinatorRound.cs
@@ -810,7 +810,7 @@ namespace WalletWasabi.CoinJoin.Coordinator.Rounds
}
// 7.2. Get the most optimal FeeRate.
- EstimateSmartFeeResponse estimateSmartFeeResponse = await RpcClient.EstimateSmartFeeAsync(AdjustedConfirmationTarget, EstimateSmartFeeMode.Conservative, simulateIfRegTest: true, tryOtherFeeRates: true).ConfigureAwait(false);
+ EstimateSmartFeeResponse estimateSmartFeeResponse = await RpcClient.EstimateSmartFeeAsync(AdjustedConfirmationTarget, EstimateSmartFeeMode.Conservative, simulateIfRegTest: true).ConfigureAwait(false);
if (estimateSmartFeeResponse is null)
{
throw new InvalidOperationException($"{nameof(FeeRate)} is not yet initialized.");
@@ -893,7 +893,7 @@ namespace WalletWasabi.CoinJoin.Coordinator.Rounds
var outputSizeInBytes = Constants.OutputSizeInBytes;
try
{
- var estimateSmartFeeResponse = await rpc.EstimateSmartFeeAsync(confirmationTarget, EstimateSmartFeeMode.Conservative, simulateIfRegTest: true, tryOtherFeeRates: true).ConfigureAwait(false);
+ var estimateSmartFeeResponse = await rpc.EstimateSmartFeeAsync(confirmationTarget, EstimateSmartFeeMode.Conservative, simulateIfRegTest: true).ConfigureAwait(false);
var feeRate = estimateSmartFeeResponse.FeeRate;
Money feePerBytes = feeRate.FeePerK / 1000;

MODIFY
WalletWasabi/Extensions/RPCClientExtensions.cs
WalletWasabi/Extensions/RPCClientExtensions.cs
@@ -14,40 +14,13 @@ namespace NBitcoin.RPC
{
public static class RPCClientExtensions
{
- public static async Task<EstimateSmartFeeResponse> EstimateSmartFeeAsync(this IRPCClient rpc, int confirmationTarget, EstimateSmartFeeMode estimateMode = EstimateSmartFeeMode.Conservative, bool simulateIfRegTest = false, bool tryOtherFeeRates = true)
+ public static async Task<EstimateSmartFeeResponse> EstimateSmartFeeAsync(this IRPCClient rpc, int confirmationTarget, EstimateSmartFeeMode estimateMode = EstimateSmartFeeMode.Conservative, bool simulateIfRegTest = false)
{
if (simulateIfRegTest && rpc.Network == Network.RegTest)
{
return SimulateRegTestFeeEstimation(confirmationTarget, estimateMode);
}
- if (tryOtherFeeRates)
- {
- try
- {
- return await rpc.EstimateSmartFeeAsync(confirmationTarget, estimateMode);
- }
- catch (Exception ex) when (ex is RPCException || ex is NoEstimationException)
- {
- Logger.LogTrace(ex);
-
- // Hopefully Bitcoin Core brainfart: https://github.com/bitcoin/bitcoin/issues/14431
- for (int i = 2; i <= Constants.SevenDaysConfirmationTarget; i++)
- {
- try
- {
- return await rpc.EstimateSmartFeeAsync(i, estimateMode);
- }
- catch (Exception ex2) when (ex2 is RPCException || ex2 is NoEstimationException)
- {
- Logger.LogTrace(ex2);
- }
- }
- }
-
- // Let's try one more time, whatever.
- }
-
return await rpc.EstimateSmartFeeAsync(confirmationTarget, estimateMode);
}
@@ -80,10 +53,10 @@ namespace NBitcoin.RPC
return null;
}
- public static async Task<AllFeeEstimate> EstimateAllFeeAsync(this IRPCClient rpc, EstimateSmartFeeMode estimateMode = EstimateSmartFeeMode.Conservative, bool simulateIfRegTest = false, bool tolerateBitcoinCoreBrainfuck = true)
+ public static async Task<AllFeeEstimate> EstimateAllFeeAsync(this IRPCClient rpc, EstimateSmartFeeMode estimateMode = EstimateSmartFeeMode.Conservative, bool simulateIfRegTest = false)
{
var rpcStatus = await rpc.GetRpcStatusAsync(CancellationToken.None).ConfigureAwait(false);
- var estimations = await rpc.EstimateHalfFeesAsync(new Dictionary<int, int>(), 2, 0, Constants.SevenDaysConfirmationTarget, 0, estimateMode, simulateIfRegTest, tolerateBitcoinCoreBrainfuck).ConfigureAwait(false);
+ var estimations = await rpc.EstimateHalfFeesAsync(new Dictionary<int, int>(), 2, 0, Constants.SevenDaysConfirmationTarget, 0, estimateMode, simulateIfRegTest).ConfigureAwait(false);
var allFeeEstimate = new AllFeeEstimate(estimateMode, estimations, rpcStatus.Synchronized);
return allFeeEstimate;
}
@@ -105,7 +78,7 @@ namespace NBitcoin.RPC
}
}
- private static async Task<Dictionary<int, int>> EstimateHalfFeesAsync(this IRPCClient rpc, IDictionary<int, int> estimations, int smallTarget, int smallTargetFee, int largeTarget, int largeTargetFee, EstimateSmartFeeMode estimateMode = EstimateSmartFeeMode.Conservative, bool simulateIfRegTest = false, bool tolerateBitcoinCoreBrainfuck = true)
+ private static async Task<Dictionary<int, int>> EstimateHalfFeesAsync(this IRPCClient rpc, IDictionary<int, int> estimations, int smallTarget, int smallTargetFee, int largeTarget, int largeTargetFee, EstimateSmartFeeMode estimateMode = EstimateSmartFeeMode.Conservative, bool simulateIfRegTest = false)
{
var newEstimations = new Dictionary<int, int>();
foreach (var est in estimations)
@@ -120,14 +93,14 @@ namespace NBitcoin.RPC
if (smallTargetFee == 0)
{
- var smallTargetFeeResult = await rpc.EstimateSmartFeeAsync(smallTarget, estimateMode, simulateIfRegTest, tolerateBitcoinCoreBrainfuck);
+ var smallTargetFeeResult = await rpc.EstimateSmartFeeAsync(smallTarget, estimateMode, simulateIfRegTest);
smallTargetFee = (int)Math.Ceiling(smallTargetFeeResult.FeeRate.SatoshiPerByte);
newEstimations.TryAdd(smallTarget, smallTargetFee);
}
if (largeTargetFee == 0)
{
- var largeTargetFeeResult = await rpc.EstimateSmartFeeAsync(largeTarget, estimateMode, simulateIfRegTest, tolerateBitcoinCoreBrainfuck);
+ var largeTargetFeeResult = await rpc.EstimateSmartFeeAsync(largeTarget, estimateMode, simulateIfRegTest);
largeTargetFee = (int)Math.Ceiling(largeTargetFeeResult.FeeRate.SatoshiPerByte);
// Blocks should never be larger than the target that we asked for, so it's just a sanity check.
@@ -136,7 +109,7 @@ namespace NBitcoin.RPC
}
int halfTarget = (smallTarget + largeTarget) / 2;
- var halfFeeResult = await rpc.EstimateSmartFeeAsync(halfTarget, estimateMode, simulateIfRegTest, tolerateBitcoinCoreBrainfuck);
+ var halfFeeResult = await rpc.EstimateSmartFeeAsync(halfTarget, estimateMode, simulateIfRegTest);
int halfTargetFee = (int)Math.Ceiling(halfFeeResult.FeeRate.SatoshiPerByte);
// Blocks should never be larger than the target that we asked for, so it's just a sanity check.
@@ -145,7 +118,7 @@ namespace NBitcoin.RPC
if (smallTargetFee > halfTargetFee)
{
- var smallEstimations = await rpc.EstimateHalfFeesAsync(newEstimations, smallTarget, smallTargetFee, halfTarget, halfTargetFee, estimateMode, simulateIfRegTest, tolerateBitcoinCoreBrainfuck);
+ var smallEstimations = await rpc.EstimateHalfFeesAsync(newEstimations, smallTarget, smallTargetFee, halfTarget, halfTargetFee, estimateMode, simulateIfRegTest);
foreach (var est in smallEstimations)
{
newEstimations.TryAdd(est.Key, est.Value);
@@ -153,7 +126,7 @@ namespace NBitcoin.RPC
}
if (largeTargetFee < halfTargetFee)
{
- var largeEstimations = await rpc.EstimateHalfFeesAsync(newEstimations, halfTarget, halfTargetFee, largeTarget, largeTargetFee, estimateMode, simulateIfRegTest, tolerateBitcoinCoreBrainfuck);
+ var largeEstimations = await rpc.EstimateHalfFeesAsync(newEstimations, halfTarget, halfTargetFee, largeTarget, largeTargetFee, estimateMode, simulateIfRegTest);
foreach (var est in largeEstimations)
{
newEstimations.TryAdd(est.Key, est.Value);

Remove more code