Skip to content

Commit

Permalink
Wallet cancellation not to throw (stratisproject#262)
Browse files Browse the repository at this point in the history
  • Loading branch information
dangershony authored Dec 13, 2018
1 parent ff5ae7a commit 41fc4ea
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,16 @@ public virtual void ProcessBlock(Block block)
// The block should be put in a queue and pushed to the wallet in an async way.
// If the wallet is behind it will just read blocks from store (or download in case of a pruned node).

token.ThrowIfCancellationRequested();

next = newTip.GetAncestor(next.Height + 1);
Block nextblock = null;
int index = 0;
while (true)
{
token.ThrowIfCancellationRequested();
if (token.IsCancellationRequested)
{
this.logger.LogTrace("(-)[CANCELLATION_REQUESTED]");
return;
}

nextblock = this.blockStore.GetBlockAsync(next.HashBlock).GetAwaiter().GetResult();
if (nextblock == null)
Expand Down

0 comments on commit 41fc4ea

Please sign in to comment.