public static async Task <EstimateSmartFeeResponse> TryEstimateSmartFeeAsync(this RPCClient rpc, int confirmationTarget, EstimateSmartFeeMode estimateMode = EstimateSmartFeeMode.Conservative, bool simulateIfRegTest = false, bool tryOtherFeeRates = false) { if (simulateIfRegTest && rpc.Network == Network.RegTest) { return(SimulateRegTestFeeEstimation(confirmationTarget, estimateMode)); } if (tryOtherFeeRates) { EstimateSmartFeeResponse response = await rpc.TryEstimateSmartFeeAsync(confirmationTarget, estimateMode); if (response != null) { return(response); } else { // Hopefully Bitcoin Core brainfart: https://github.com/bitcoin/bitcoin/issues/14431 for (int i = 2; i <= Constants.SevenDaysConfirmationTarget; i++) { response = await rpc.TryEstimateSmartFeeAsync(i, estimateMode); if (response != null) { return(response); } } } // Let's try one more time, whatever. } return(await rpc.TryEstimateSmartFeeAsync(confirmationTarget, estimateMode)); }
public static async Task <EstimateSmartFeeResponse> TryEstimateSmartFeeAsync(this RPCClient rpc, int confirmationTarget, EstimateSmartFeeMode estimateMode = EstimateSmartFeeMode.Conservative, bool simulateIfRegTest = false) { if (simulateIfRegTest && rpc.Network == Network.RegTest) { return(SimulateRegTestFeeEstimation(confirmationTarget, estimateMode)); } return(await rpc.TryEstimateSmartFeeAsync(confirmationTarget, estimateMode)); }