Esempio n. 1
0
        protected override async Task ActionAsync(CancellationToken cancel)
        {
            try
            {
                var allFeeEstimate = await RpcClient.EstimateAllFeeAsync(EstimateSmartFeeMode.Conservative, true).ConfigureAwait(false);

                var uptime = await RpcClient.UptimeAsync().ConfigureAwait(false);

                // If Core was running for a day already, then we can be pretty sure that the estimate is accurate.
                // It could also be accurate if Core was only shut down for a few minutes, but that's hard to figure out.
                allFeeEstimate.IsAccurate = uptime > TimeSpan.FromDays(1);

                if (allFeeEstimate?.Estimations?.Any() is true)
                {
                    AllFeeEstimateArrived?.Invoke(this, allFeeEstimate);
                }
                LastAllFeeEstimate = allFeeEstimate;
                InError            = false;
            }
            catch
            {
                InError = true;
                throw;
            }
        }
    protected override async Task ActionAsync(CancellationToken cancel)
    {
        if (IsPaused)
        {
            return;
        }
        try
        {
            var allFeeEstimate = await BlockstreamInfoClient.GetFeeEstimatesAsync(cancel).ConfigureAwait(false);

            LastAllFeeEstimate = allFeeEstimate;

            if (allFeeEstimate.Estimations.Any())
            {
                AllFeeEstimateArrived?.Invoke(this, allFeeEstimate);
            }

            InError = false;
        }
        catch
        {
            InError = true;
            throw;
        }
    }