BitSharper.PeerGroup.StartBlockChainDownload C# (CSharp) Method

StartBlockChainDownload() public method

Start downloading the block chain from the first available peer.
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.
public StartBlockChainDownload ( IPeerEventListener listener ) : void
listener IPeerEventListener A listener for chain download events, may not be null.
return void
        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);
                }
            }
        }