public async Task <BigInteger> GetLastConfirmedBlockNumberAsync(BigInteger?waitForConfirmedBlockNumber, CancellationToken cancellationToken) { var currentBlockOnChain = await GetCurrentBlockOnChainAsync(); uint attemptCount = 0; while (!IsBlockNumberConfirmed(waitForConfirmedBlockNumber, currentBlockOnChain.Value, _minimumBlockConfirmations)) { if (!cancellationToken.IsCancellationRequested) { attemptCount++; LogWaitingForBlockAvailability(currentBlockOnChain, _minimumBlockConfirmations, waitForConfirmedBlockNumber, attemptCount); await _waitStrategy.ApplyAsync(attemptCount).ConfigureAwait(false); currentBlockOnChain = await GetCurrentBlockOnChainAsync().ConfigureAwait(false); } } return(currentBlockOnChain); }