Unexplained 1 million block height in mempool code #15080

issue instagibbs opened this issue on January 2, 2019
  1. instagibbs commented at 5:00 PM on January 2, 2019: member
  2. fanquake added the label Mempool on Jan 2, 2019
  3. fanquake commented at 12:06 AM on January 3, 2019: member

    Looks like it was introduced by @TheBlueMatt in #5267.

  4. promag commented at 7:34 PM on January 28, 2019: member

    A block far far away?

  5. instagibbs commented at 7:40 PM on January 28, 2019: member

    It's not for testnet.

    On Mon, Jan 28, 2019, 7:35 PM João Barbosa <notifications@github.com wrote:

    A block far far away?

    — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bitcoin/bitcoin/issues/15080#issuecomment-458270164, or mute the thread https://github.com/notifications/unsubscribe-auth/AFgC04pUw8iuSBR1Ae1XhOlVJ5P6azI-ks5vH1EOgaJpZM4Zm8HF .

  6. MarcoFalke added the label Brainstorming on Jan 28, 2019
  7. instagibbs commented at 2:56 PM on April 6, 2019: member

    I'm having a really difficult time convincing myself this behavior could not lead to incorrect results. But this can only be hit when -checkmempool is non-0, aka -regtest by default so it's not used in production.

    I think here the spendheight is the correct height since that is where this duplicate mempool is actually at.

    I'll think a little more how a false assertion or validation failure could hit if unchanged.

  8. instagibbs closed this on Apr 6, 2019

  9. instagibbs reopened this on Apr 6, 2019

  10. mzumsande commented at 3:59 PM on May 20, 2019: member

    I think that the height currently specified as a magic number is never accessed:

    In check(), the ancestor tx of the mempool are "spent" in the UpdateCoins() function (adding new UTXOs to the local cache mempoolDuplicate), providing the inputs for subsequent spending of the dependent tx, and thereby allowing to check that all tx in the mempool can be mined in some order (no orphans).

    While all ancestors need to be added to mempoolDuplicate, the height at which they are added is not checked in mempoolDuplicate.HaveInputs(), just their COutPoint.

    I did some testing with a height of 0 instead of 1E6 and didn't see any effect. So I don't see how the current implementation could lead to a bug, though I agree that using spendheight would make more sense and might prevent future bugs.

  11. instagibbs commented at 4:03 PM on May 20, 2019: member

    Lines up with my current thinking.

  12. laanwj referenced this in commit de458da0c1 on May 29, 2019
  13. MarcoFalke closed this on May 29, 2019

  14. sidhujag referenced this in commit 362d0777c7 on May 30, 2019
  15. PastaPastaPasta referenced this in commit 758a470cb7 on Jun 27, 2021
  16. PastaPastaPasta referenced this in commit 119c1f82b9 on Jun 28, 2021
  17. PastaPastaPasta referenced this in commit 3cf5c685f5 on Jun 29, 2021
  18. PastaPastaPasta referenced this in commit 79af4eaa30 on Jul 1, 2021
  19. PastaPastaPasta referenced this in commit e9b5a6b4d6 on Jul 1, 2021
  20. PastaPastaPasta referenced this in commit 7243a59952 on Jul 12, 2021
  21. MarcoFalke 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-27 03:15 UTC

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