Skip to content

Commit

Permalink
Update BitcoinJobManager.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaolin1579 committed Jun 20, 2024
1 parent d3fcee7 commit 1c5299e
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions src/Miningcore/Blockchain/Bitcoin/BitcoinJobManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,39 +100,6 @@ protected override async Task EnsureDaemonsSynchedAsync(CancellationToken ct)
} while(await timer.WaitForNextTickAsync(ct));
}

protected override async Task EnsureDaemonsSynchedAsync(CancellationToken ct)
{
using var timer = new PeriodicTimer(TimeSpan.FromSeconds(5));

var syncPendingNotificationShown = false;

do
{
var response = await rpc.ExecuteAsync<BlockTemplate>(logger,
BitcoinCommands.GetBlockTemplate, ct, GetBlockTemplateParams());

var isSynched = response.Error == null;

if(isSynched)
{
logger.Info(() => "All daemons synched with blockchain");
break;
}
else
{
logger.Debug(() => $"Daemon reports error: {response.Error?.Message}");
}

if(!syncPendingNotificationShown)
{
logger.Info(() => "Daemon is still syncing with network. Manager will be started once synced.");
syncPendingNotificationShown = true;
}

await ShowDaemonSyncProgressAsync(ct);
} while(await timer.WaitForNextTickAsync(ct));
}

protected async Task<RpcResponse<BlockTemplate>> GetBlockTemplateAsync(CancellationToken ct)
{
var result = await rpc.ExecuteAsync<BlockTemplate>(logger,
Expand Down

0 comments on commit 1c5299e

Please sign in to comment.