diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-10-14 11:32:12 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-10-14 11:35:17 +0200 |
commit | 992ab87114b8c9ea8230e97a9c8d8bd71939074d (patch) | |
tree | 0ee6087b370083783b41aa6362034e631c797b20 /src/net.cpp | |
parent | 2e4f6127bf6e9f01ea5eb0f711b275270c489e9d (diff) | |
parent | 94064710b9123dfb3df8cfd6c32efae349aec281 (diff) |
Merge pull request #4942
9406471 Write fee estimate and peers files only when initialized (Wladimir J. van der Laan)
Diffstat (limited to 'src/net.cpp')
-rw-r--r-- | src/net.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/net.cpp b/src/net.cpp index 866bac2c0e..dd5cb480cc 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -78,6 +78,7 @@ uint64_t nLocalHostNonce = 0; static std::vector<ListenSocket> vhListenSocket; CAddrMan addrman; int nMaxConnections = 125; +bool fAddressesInitialized = false; vector<CNode*> vNodes; CCriticalSection cs_vNodes; @@ -1739,6 +1740,18 @@ void static Discover(boost::thread_group& threadGroup) void StartNode(boost::thread_group& threadGroup) { + uiInterface.InitMessage(_("Loading addresses...")); + // Load addresses for peers.dat + int64_t nStart = GetTimeMillis(); + { + CAddrDB adb; + if (!adb.Read(addrman)) + LogPrintf("Invalid or missing peers.dat; recreating\n"); + } + LogPrintf("Loaded %i addresses from peers.dat %dms\n", + addrman.size(), GetTimeMillis() - nStart); + fAddressesInitialized = true; + if (semOutbound == NULL) { // initialize semaphore int nMaxOutbound = min(MAX_OUTBOUND_CONNECTIONS, nMaxConnections); @@ -1785,7 +1798,12 @@ bool StopNode() if (semOutbound) for (int i=0; i<MAX_OUTBOUND_CONNECTIONS; i++) semOutbound->post(); - DumpAddresses(); + + if (fAddressesInitialized) + { + DumpAddresses(); + fAddressesInitialized = false; + } return true; } |