Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix NOTFOUND bug and expire getdata requests for transactions #15834
Here's a more stripped down alternative to #15776, which may be quicker to review. This backports cleanly to 0.18 and should resolve the outstanding p2p issue.
To recap - there's a bug in managing the data structures tracking transaction downloads in-flight from our peers that was introduced in #14897, specifically concerning the handling of NOTFOUND messages.
This PR fixes that bug, and it adds a general expiry mechanism (originally proposed by @ajtowns in #15776) for removing entries from the in-flight map, to add robustness in the event there are scenarios we're overlooking that might cause the in-flight data structures to fill up over time.
referenced this pull request
Apr 17, 2019
@gmaxwell Not that I can see. It looks to me like the only way a peer could "send" us a transaction that doesn't get dequeued is if it fails to deserialize successfully; once we've deserialized I don't think there's a code path that would not result in updating the data structures.
I've updated this PR and believe the bugs have now been fixed. I've also got a test, but with the delays involved it takes a very long time to run (ie the test has to sit around and wait for various timeouts). I'm guessing people don't want to include a test in the test suite (even an extended test) that would take tens of minutes to complete.
Would reviewers prefer me to switch the uses of GetTimeMicros() in the logic to GetTime() so that we can mock it, and then include a functional test that uses mocktime? If such tests are viewed as too contrived then I'll skip it and leave this PR as is.
ajtowns left a comment
Would be good to fix the
I think changes for future PRs are: