public static async Task <EstimateSmartFeeResponse> EstimateSmartFeeAsync(this IRPCClient rpc, int confirmationTarget, FeeRate sanityFeeRate, EstimateSmartFeeMode estimateMode = EstimateSmartFeeMode.Conservative, bool simulateIfRegTest = false) { EstimateSmartFeeResponse result; if (simulateIfRegTest && rpc.Network == Network.RegTest) { result = SimulateRegTestFeeEstimation(confirmationTarget, estimateMode); } else { result = await rpc.EstimateSmartFeeAsync(confirmationTarget, estimateMode).ConfigureAwait(false); } result.FeeRate = FeeRate.Max(sanityFeeRate, result.FeeRate); return(result); }
public static async Task <EstimateSmartFeeResponse> EstimateSmartFeeAsync(this IRPCClient rpc, int confirmationTarget, EstimateSmartFeeMode estimateMode = EstimateSmartFeeMode.Conservative, bool simulateIfRegTest = false, CancellationToken cancellationToken = default) { EstimateSmartFeeResponse result; if (simulateIfRegTest && rpc.Network == Network.RegTest) { result = SimulateRegTestFeeEstimation(confirmationTarget, estimateMode); } else { result = await rpc.EstimateSmartFeeAsync(confirmationTarget, estimateMode, cancellationToken).ConfigureAwait(false); var mempoolInfo = await rpc.GetMempoolInfoAsync(cancellationToken).ConfigureAwait(false); result.FeeRate = FeeRate.Max(mempoolInfo.GetSanityFeeRate(), result.FeeRate); } return(result); }
public void FeeRateComparison() { var a = new FeeRate(Money.Coins(2.0m)); var b = new FeeRate(Money.Coins(4.0m)); Assert.True(a < b); Assert.True(b > a); Assert.False(b < a); Assert.False(a > b); Assert.True(a != b); Assert.True(b != a); Assert.True(FeeRate.Min(a, b) == a); Assert.True(FeeRate.Min(b, a) == a); Assert.True(FeeRate.Max(a, b) == b); Assert.True(FeeRate.Max(b, a) == b); Assert.True(a.CompareTo(b) < 0); Assert.True(b.CompareTo(a) > 0); Assert.True(a.CompareTo(a) == 0); Assert.True(b.CompareTo(b) == 0); var aa = new FeeRate(Money.Coins(2.0m)); var bb = new FeeRate(Money.Coins(4.0m)); var o = new object(); Assert.True(a == aa); Assert.True(a.Equals(aa)); Assert.False(a.Equals(o)); Assert.True(b == bb); Assert.True(b != aa); Assert.True(b != (null as FeeRate)); Assert.True((null as FeeRate) == (null as FeeRate)); Assert.False((null as FeeRate) != (null as FeeRate)); Assert.False(a.Equals(b)); Assert.True(aa == a); Assert.True(bb == b); }