Ejemplo n.º 1
0
 public uint256 WaitBlock(uint256 currentBlock, CancellationToken cancellation = default(CancellationToken))
 {
     while (true)
     {
         cancellation.ThrowIfCancellationRequested();
         var h = _RPCClient.GetBestBlockHash();
         if (h != currentBlock)
         {
             _Cache.Refresh(h);
             return(h);
         }
         cancellation.WaitHandle.WaitOne(5000);
     }
 }
 public uint256 WaitBlock(uint256 currentBlock, CancellationToken cancellation = default(CancellationToken))
 {
     while (true)
     {
         cancellation.ThrowIfCancellationRequested();
         var h = _RPCClient.GetBestBlockHash();
         if (h != currentBlock)
         {
             Console.WriteLine("* New block received by server: " + h);
             _Cache.Refresh(h);
             return(h);
         }
         if (this.RPCClient.Network != Network.RegTest)
         {
             cancellation.WaitHandle.WaitOne(5000);
         }
         else
         {
             // For deep integration tests there is a race condition between the client and server when processing incoming blocks
             cancellation.WaitHandle.WaitOne(500);
         }
     }
 }