index: Fix for indexers skipping genesis block. #14085

pull jimpo wants to merge 1 commits into bitcoin:master from jimpo:txindex-genesis-fix changing 3 files +15 −1
  1. jimpo commented at 7:30 PM on August 27, 2018: contributor

    This fixes a bug where indexers would skip processing of the genesis block. Preserves the current behavior of omitting genesis block transaction from the index.

  2. instagibbs commented at 7:50 PM on August 27, 2018: member

    @sipa has NACK'd this previously when I offered a "fix".

    Reasoning is something like: Txindex was used previous to Core maintaining a pruned utxo set, and thus never had use for the genesis block transaction, since it was never entered into the utxo set.

    I personally concept ACK, just giving background.

  3. jimpo commented at 7:53 PM on August 27, 2018: contributor

    Even if we decide to exclude the genesis transaction from the txindex specifically, we should still fix in the BaseIndex and add an exception in the TxIndex subclass.

  4. MarcoFalke commented at 7:57 PM on August 27, 2018: member

    What was the previous behaviour (e.g. in version 0.15 with -txindex)?

  5. gmaxwell commented at 11:36 PM on August 27, 2018: contributor

    That transaction isn't really in the blockchain in almost any meaningful sense: It has no effect on the system state. e.g. it shouldn't show up in address indexing either, because although it looks spendable it's not spendable.

  6. index: Fix for indexers skipping genesis block. ed12d5df1b
  7. jimpo force-pushed on Aug 28, 2018
  8. jimpo commented at 7:16 PM on August 28, 2018: contributor

    @MarcoFalke I'm pretty sure prior behavior was to include it in the index. <- That's wrong, it was omitted from the index. I ran a 0.15.1 node to verify.

  9. sipa commented at 8:24 PM on August 28, 2018: member

    The genesis transaction was never included in any index, intentionally.

  10. luke-jr commented at 1:06 PM on August 30, 2018: member

    IMO, a merkle root of 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b indicates the block has 0 transactions. ;)

  11. laanwj added the label UTXO Db and Indexes on Aug 31, 2018
  12. laanwj commented at 8:38 PM on August 31, 2018: member

    ~0 on this

  13. DrahtBot commented at 11:09 PM on August 31, 2018: member

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #14121 (Index for BIP 157 block filters by jimpo)
    • #14111 (index: Create IndexRunner class for activing indexes. by jimpo)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  14. sipa commented at 3:55 AM on November 10, 2018: member

    ~0 on this as well - it could be considered if there is ever an indexer that needs to observe the genesis block somehow, but I don't see why that would be the case.

  15. jimpo commented at 6:19 PM on November 10, 2018: contributor

    @sipa The block filter headers commit the the filter header of the previous block and BIP 157 defines a filter header for the genesis block, which is the motivation for this PR. The BIP could be amended to define the filter header of the genesis as 0, but I feel like this is a silly reason to change the BIP. Also, the genesis block is a block -- it's very unintuitive to me that it would get skipped by default just because it's a special block with no effect on the chain state.

  16. sipa commented at 6:34 PM on November 10, 2018: member

    @jimpo I see, that's a perfectly good reason. There is no restriction on downloading the genesis block either.

  17. sipa commented at 3:07 AM on November 11, 2018: member

    utACK ed12d5df1ba52b5ef3dd3799de26bb5e1d3fc654

  18. jonasschnelli commented at 10:55 AM on November 11, 2018: contributor

    utACK ed12d5df

  19. luke-jr commented at 6:14 PM on December 19, 2018: member

    @jimpo The genesis block de facto has ZERO transactions. IMO it is a bug in BIP 157 if it considers that it does.

  20. jimpo commented at 4:21 AM on December 22, 2018: contributor

    @luke-jr Per BIP 157, the genesis block does have a filter and it has a single element, an output. Since this output is unspendable, this does seem like a bug on reflection. Would everyone be happier if I change BIP 157 so that there is no filter for the genesis block and it's filter header becomes 0x00{32}? @roasbeef

  21. laanwj added this to the "Blockers" column in a project

  22. laanwj commented at 8:57 PM on January 3, 2019: member

    This has enough (ut)ACKs, but the last post makes it unclear to me whether to merge this now, probably better to wait for BIP clarification or not?

  23. Roasbeef commented at 10:04 PM on January 3, 2019: none

    @jimpo I don't see a good reason to modify the format of the filters this late in the cycle. A number of individuals are already running BIP 157/158 on mainnet as other full node implementations are already able to serve them. I think we all understand that the genesis block is unspendable, but it does in fact have transactions, though they don't modify the UTXO set. Why add another special case?

  24. jimpo commented at 8:07 PM on January 6, 2019: contributor

    @laanwj I think the BIP is fine and I haven't heard serious objections. I think this should get merged and if there is a call to change the genesis filter in the BIP it's a one-line change (similar to what was done with txindex). I still think 100% that the base index should not skip the genesis block, which is the main thing this fixes.

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

    This is ready for merge IMO.

  26. laanwj merged this on Jan 9, 2019
  27. laanwj closed this on Jan 9, 2019

  28. laanwj referenced this in commit e12a480e40 on Jan 9, 2019
  29. laanwj removed this from the "Blockers" column in a project

  30. UdjinM6 referenced this in commit 73e7f5b07c on Jun 20, 2021
  31. UdjinM6 referenced this in commit f6b8aac4c3 on Jun 24, 2021
  32. UdjinM6 referenced this in commit db1898edd7 on Jun 29, 2021
  33. UdjinM6 referenced this in commit f0edda6839 on Jun 29, 2021
  34. UdjinM6 referenced this in commit d25d155ff7 on Jul 1, 2021
  35. Munkybooty referenced this in commit 43bb4f3bb0 on Aug 20, 2021
  36. Munkybooty referenced this in commit 96b82d087e on Aug 20, 2021
  37. 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 06:15 UTC

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