Esempio n. 1
0
 /// <summary>
 /// Start downloading the block chain from the first available peer.
 /// </summary>
 /// <remarks>
 /// If no peers are currently connected, the download will be started
 /// once a peer starts. If the peer dies, the download will resume with another peer.
 /// </remarks>
 /// <param name="listener">A listener for chain download events, may not be null.</param>
 public void StartBlockChainDownload(IPeerEventListener listener)
 {
     lock (syncRoot)
     {
         _downloadListener = listener;
         // TODO be more nuanced about which peer to download from. We can also try
         // downloading from multiple peers and handle the case when a new peer comes along
         // with a longer chain after we thought we were done.
         lock (_peers)
         {
             var firstPeer = _peers.FirstOrDefault();
             if (firstPeer != null)
             {
                 StartBlockChainDownloadFromPeer(firstPeer);
             }
         }
     }
 }
 /// <summary>
 /// Start downloading the block chain from the first available peer.
 /// </summary>
 /// <remarks>
 /// If no peers are currently connected, the download will be started
 /// once a peer starts. If the peer dies, the download will resume with another peer.
 /// </remarks>
 /// <param name="listener">A listener for chain download events, may not be null.</param>
 public void StartBlockChainDownload(IPeerEventListener listener)
 {
     lock (this)
     {
         _downloadListener = listener;
         // TODO be more nuanced about which peer to download from. We can also try
         // downloading from multiple peers and handle the case when a new peer comes along
         // with a longer chain after we thought we were done.
         lock (_peers)
         {
             var firstPeer = _peers.FirstOrDefault();
             if (firstPeer != null)
                 StartBlockChainDownloadFromPeer(firstPeer);
         }
     }
 }