validation: remove useless uncache accounting in ATMPW #15264

pull jamesob wants to merge 1 commits into bitcoin:master from jamesob:2019-01-remove-useless-uncaching-atmpw changing 1 files +2 −10
  1. jamesob commented at 7:57 PM on January 25, 2019: member

    AcceptToMemoryPoolWorker takes an out-param called coins_to_uncache which it populates with any outpoints-to-be-spent that do not exist in pcoinsTip's in-memory cache.

    Confusingly, we then attempt to pcoinsTip->Uncache() those outpoints if the transaction can't be added to the mempool. But we only added those outpoints to coins_to_uncache if they didn't exist in pcoinsTip's cache... so this whole parameter and process seems useless. Maybe I'm missing something?

  2. validation: remove useless uncache accounting in ATMPW 4b714b7c8b
  3. sipa commented at 7:59 PM on January 25, 2019: member

    The point is that these coins were pulled into the cache by ATMPW, but we don't want them there, so they're actively removed afterwards.

  4. sdaftuar commented at 7:59 PM on January 25, 2019: member

    The idea is that we uncache the inputs that were added to pcoinsTip during validation of the rejected transaction. Otherwise, someone could send us junk transactions that waste our cache memory, harming performance.

  5. jamesob commented at 9:09 PM on January 25, 2019: member

    Ah, my bad - thanks for the pointers!

    I had trouble finding where the outpoints were actually being added to pcoinsTip; it turns out the addition is buried in a call to view.HaveCoin() -> view.FetchCoin(), both of which are (somewhat confusingly) marked const.

    I'll follow up with a doc PR for posterity.

  6. jamesob closed this on Jan 25, 2019

  7. MarcoFalke referenced this in commit d76b72a454 on Apr 26, 2019
  8. vijaydasmp referenced this in commit 459498b69c on Oct 19, 2021
  9. DrahtBot locked this on Dec 16, 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:14 UTC

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