I see no reason not to erase a requested tx this from the AlreadyAskedFor list at the point the tx is received. Otherwise the risk is that the node continues requesting it from peers. (It will of course get re-added if its inv is seen and it's not processed, but this is already the case also).
Remove tx from AlreadyAskedFor list once we receive it, not when we process it. #4460
pull rebroad wants to merge 1 commits into bitcoin:master from rebroad:MoveMapAlreadyAskedForErase changing 1 files +3 −3-
rebroad commented at 8:35 AM on July 3, 2014: contributor
-
gmaxwell commented at 3:39 AM on July 16, 2014: contributor
Uh. If you remove it from the AlreadyAskedFor map and we rejected it, we'll potentially end up requesting it again from the same peer. Or am I missing something there?
-
Remove tx from AlreadyAskedFor list once we receive it, not when we process it. 604ee2aa7d
-
kazcw commented at 11:03 AM on July 16, 2014: contributor
@rebroad mapAlreadyAskedFor is what prevents asking additional peers for the same tx before it meets the AlreadyHave criteria. AlreadyHave doesn't currently return true if the tx is not an orphan but is rejected from the mempool; so as it stands, rejected tx must not be removed from the map since they are never included in AlreadyHave. #4542 would make this PR work.
-
BitcoinPullTester commented at 11:44 AM on July 16, 2014: none
Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/p4460_604ee2aa7d110439b4e59ecaa272b85ec41ab6a0/ 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.
- laanwj added the label P2P on Jul 31, 2014
-
laanwj commented at 3:28 PM on September 2, 2014: member
@rebroad This makes a lot of sense. Currently, entries of mapAlreadyAskedFor linger there forever if the transaction is invalid. Removing them when the requested data arrives is the correct thing to do.
The task of mapAlreadyAskedFor was never to make sure that we don't request anything again. It just keeps track of a timestamp for retries. Indeed, the name is misleading.
(so this is part of the functionality of requesting a piece of data; the decision of whether to request something in the first place needs to be made somewhere else, #4542 makes sense there)
Tested ACK.
- laanwj merged this on Sep 16, 2014
- laanwj closed this on Sep 16, 2014
- laanwj referenced this in commit f010344156 on Sep 16, 2014
- rebroad deleted the branch on Sep 29, 2014
- DrahtBot locked this on Sep 8, 2021