- fixes #4669
prevent overwriting peers.dat if we have 0 addresses #4784
pull Diapolo wants to merge 2 commits into bitcoin:master from Diapolo:fix_dumpaddresses changing 3 files +10 −5-
Diapolo commented at 9:32 PM on August 28, 2014: none
-
jgarzik commented at 9:37 PM on August 28, 2014: contributor
Your solution is generally OK
addrman.size() will never be negative
Hey, that would make a great addrman cleanup, wouldn't it? :)
-
Diapolo commented at 9:47 PM on August 28, 2014: none
@jgarzik 1./3. Yeah, I intended to not fix the larger problem with the lockfile, but the specific one mentioned. 2. Will update, thanks for catching it :). 4. But we return an int for the size so isn't it better to leave it that way? 5. Do you want me to make size an unsigned integer or change the commit-msg ^^, don't understand.
-
jgarzik commented at 10:46 PM on August 28, 2014: contributor
@Diapolo addrman's size() should return 'unsigned int' (technically size_type, what std::vector<>::size() returns) And in doing so, that makes testing addrman.size() less-than-zero incorrect, enabling removal of that case (becomes not-zero test).
-
f56aa076ff
prevent overwriting peers.dat if we have 0 addresses
- fixes #4669
-
change addrman::size() to return size_t 4985aaa43a
-
BitcoinPullTester commented at 10:05 AM on August 29, 2014: none
Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/p4784_4985aaa43a5a4762db3f16037c2da43aad3ff21f/ for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.
-
in src/net.cpp:None in 4985aaa43a
1262 | @@ -1263,13 +1263,17 @@ void ThreadDNSAddressSeed() 1263 | 1264 | void DumpAddresses() 1265 | { 1266 | + // Prevent overwriting peers.dat in case addrman is empty
laanwj commented at 3:28 AM on August 30, 2014:Now you use
addrman.size()==0implicitly to determine whether to write the list at exit. It works, but could lead to strange corner case if we actually need to write an empty list for some reason in the future.It would lead to more understandable code to explicitly keep track of whether we reached the stage of initialization where addrman was initialized.
A more general solution would be to keep track (in net.cpp) whether StartNode was called. If not, don't do any cleanup in StopNode (which includes the call to DumpAddresses that is the culprit here).
laanwj closed this on Sep 18, 2014Diapolo deleted the branch on Mar 21, 2015MarcoFalke locked this on Sep 8, 2021
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 18:15 UTC
More mirrored repositories can be found on mirror.b10c.me