mapAlreadyAskedFor gets additions when AlreadyHave() #1347

pull rebroad wants to merge 1 commits into bitcoin:master from rebroad:FixAlreadyAskedFor changing 1 files +1 −1
  1. rebroad commented at 10:03 PM on May 17, 2012: contributor

    Without this change, mappings will be created even after AlreadyHave equals true, and will never be erased.

    A small fix, probably would never have caused a problem, other than filling unbounded and potentially using up more memory than needed. Might be quite significant is bitcoind is left running for a long period of time.

  2. Should only be mapped when the getdata is done.
    Without this change, mappings will be created even after AlreadyHave equals true, and will never be erased.
    757cec9ddd
  3. rebroad commented at 10:05 PM on May 17, 2012: contributor

    @jgarzik I would argue that had this mapping been named mapWaitingFor (as per #1341), this bug would have been less likely to have occurred, since upon renaming it becomes more intuitively obvious that it's in the wrong place in the code.

    I do think quite strongly that #1341 should be re-opened for some discusssion. If POLA isn't a good reason for a variable name change, then what is?

  4. gavinandresen commented at 4:59 PM on May 18, 2012: contributor

    How should this change be tested?

  5. sipa commented at 7:55 PM on May 20, 2012: member

    Not tested, but @rebroad's reasoning sounds correct to me. mapAlreadyAskedFor contains getdata requests that have not been answered yet. If AlreadyHave() returns true for an inv, there is no reason to keep waiting for it.

  6. gavinandresen commented at 2:47 PM on June 27, 2012: contributor

    mmm. I feel like I'll regret this, but ACK.

  7. sipa referenced this in commit abbb9a829c on Jun 27, 2012
  8. sipa merged this on Jun 27, 2012
  9. sipa closed this on Jun 27, 2012

  10. coblee referenced this in commit 275804d11d on Jul 17, 2012
  11. rebroad deleted the branch on Dec 20, 2012
  12. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

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-22 18:16 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me