Disable mempool-base feature for Core
MODIFY
WalletWasabi.Tests/UnitTests/AllFeeEstimateTests.cs
WalletWasabi.Tests/UnitTests/AllFeeEstimateTests.cs
@@ -236,6 +236,23 @@ namespace WalletWasabi.Tests.UnitTests
Assert.True(allFee.Estimations[36] > 1);
}
+ [Fact]
+ public async Task WorksWithBitcoinCoreEstimationsAsync()
+ {
+ var rpc = CreateAndConfigureRpcClient(
+ estimator: target => target switch
+ {
+ 2 => new FeeRate(120m),
+ _ => throw new NoEstimationException(target)
+ },
+ hasPeersInfo: true
+ );
+ rpc.OnGetMempoolInfoAsync = async () => await Task.FromResult(new MemPoolInfo());
+
+ // Do not throw exception
+ await rpc.EstimateAllFeeAsync(EstimateSmartFeeMode.Conservative);
+ }
+
[Fact]
public async Task ExhaustiveEstimationsAsync()
{

MODIFY
WalletWasabi/BitcoinCore/Rpc/RpcClientBase.cs
WalletWasabi/BitcoinCore/Rpc/RpcClientBase.cs
@@ -61,7 +61,9 @@ namespace WalletWasabi.BitcoinCore.Rpc
public virtual async Task<MemPoolInfo> GetMempoolInfoAsync()
{
- var response = await Rpc.SendCommandAsync(RPCOperations.getmempoolinfo, true);
+ try
+ {
+ var response = await Rpc.SendCommandAsync(RPCOperations.getmempoolinfo, true).ConfigureAwait(false);
static IEnumerable<FeeRateGroup> ExtractFeeRateGroups(JToken jt) =>
jt switch {
@@ -89,6 +91,11 @@ namespace WalletWasabi.BitcoinCore.Rpc
Histogram = ExtractFeeRateGroups(response.Result["fee_histogram"]).ToArray()
};
}
+ catch (RPCException)
+ {
+ return await Rpc.GetMemPoolAsync().ConfigureAwait(false);
+ }
+ }
public virtual async Task<uint256[]> GetRawMempoolAsync()
{

MODIFY
WalletWasabi/Extensions/RPCClientExtensions.cs
WalletWasabi/Extensions/RPCClientExtensions.cs
@@ -75,11 +75,12 @@ namespace NBitcoin.RPC
var mempoolInfo = await rpc.GetMempoolInfoAsync().ConfigureAwait(false);
var sanityFeeRate = mempoolInfo.GetSanityFeeRate();
+ var rpcStatus = await rpc.GetRpcStatusAsync(CancellationToken.None).ConfigureAwait(false);
+ if (mempoolInfo.Histogram is { })
+ {
var minEstimations = GetFeeEstimationsFromMempoolInfo(mempoolInfo);
- var rpcStatus = await rpc.GetRpcStatusAsync(CancellationToken.None).ConfigureAwait(false);
-
var fixedEstimations = smartEstimations.GroupJoin(minEstimations,
outer => outer.Key,
inner => inner.Key,
@@ -94,6 +95,12 @@ namespace NBitcoin.RPC
rpcStatus.Synchronized);
}
+ return new AllFeeEstimate(
+ estimateMode,
+ smartEstimations,
+ rpcStatus.Synchronized);
+ }
+
private static async Task<Dictionary<int, int>> GetFeeEstimationsAsync(IRPCClient rpc, EstimateSmartFeeMode estimateMode)
{
var batchClient = rpc.PrepareBatch();

Disable mempool-base feature for Core