Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion src/Blockcore/P2P/PeerAddressManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,25 @@ public PeerAddressManager(IDateTimeProvider dateTimeProvider, DataFolder peerFil
/// <inheritdoc />
public void LoadPeers()
{
List<PeerAddress> loadedPeers = this.fileStorage.LoadByFileName(PeerFileName);
List<PeerAddress> loadedPeers;

try
{
loadedPeers = this.fileStorage.LoadByFileName(PeerFileName);
}
catch (Exception e)
{
this.logger.LogError("Error loading peers JSON, defaulting to empty list: {0}", e);

loadedPeers = new List<PeerAddress>();
}

if (loadedPeers == null)
loadedPeers = new List<PeerAddress>();

// If the loaded peers is still empty at this point, we rely on the discovery loop to find new peers to connect to.
// The discovery loop will only not run if -connect is used or if there are un-attempted peers left, so as long as
// there are seed nodes & DNS seeds available we should get something to connect to relatively rapidly.

this.logger.LogDebug("{0} peers were loaded.", loadedPeers.Count);

Expand Down