Improve AlreadyHave #7874

pull morcos wants to merge 1 commits into bitcoin:master from morcos:speedAlreadyHave changing 1 files +3 −1
  1. morcos commented at 8:20 PM on April 13, 2016: member

    AlreadyHave is called for transactions in 3 places:

    • when an INV is received to decide whether to schedule a request of the tx
    • when a TX is received to decide whether to process it
    • when actually requesting a tx to see if it has been received since scheduling the request

    In a large number of these cases, the transaction in question is new and fails each of the tests in the return statement. In particular it is very unlikely (< 10%) to hit the pcoinsTip check and then be found. But pcoinsTip must check the database to be sure it can't find the transaction. Switching the full HaveCoins check for the fast HaveCoinsInCache check will still prevent the vast majority of false negatives but will never need a database access. The downside is after the cache has been flushed there maybe be a very few more cases of requesting already confirmed transactions from peers.

  2. Avoid unnecessary database access for unknown transactions c6cb6f7d4c
  3. pstratem commented at 9:42 PM on April 13, 2016: contributor

    utACK c6cb6f7d4c4bbfe96256c66b3aef4e7e3ff6285f

  4. laanwj added the label P2P on Apr 14, 2016
  5. sipa commented at 9:24 AM on April 14, 2016: member

    utACK c6cb6f7d4c4bbfe96256c66b3aef4e7e3ff6285f

  6. btcdrak commented at 11:54 AM on April 14, 2016: contributor

    utACK c6cb6f7

  7. laanwj merged this on Apr 14, 2016
  8. laanwj closed this on Apr 14, 2016

  9. laanwj referenced this in commit e6a4d48a9b on Apr 14, 2016
  10. codablock referenced this in commit 9a3c666e70 on Sep 16, 2017
  11. codablock referenced this in commit d31012168d on Sep 19, 2017
  12. codablock referenced this in commit 694fe82ee5 on Sep 27, 2017
  13. codablock referenced this in commit d167cfd34d on Oct 12, 2017
  14. codablock referenced this in commit 753cb1563b on Oct 19, 2017
  15. UdjinM6 referenced this in commit 3ecab82a99 on Nov 8, 2017
  16. random-zebra referenced this in commit 616b102f8b on Aug 13, 2020
  17. MarcoFalke 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-15 15:15 UTC

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