miner: Enforce Murch-Zawy rule (BIP54) #35949

pull fjahr wants to merge 1 commits into bitcoin:master from fjahr:2026-08-mz-miner changing 2 files +44 −0
  1. fjahr commented at 1:36 PM on August 11, 2026: contributor

    Opened separate from #35793 as requested by darosior. This makes the miner enforce the murch-zawy rule for which #35793 adds the validation part.

    A node whose clock is behind the first block of the difficulty period currently reports a mintime below the consensus floor in getblocktemplate and fails to build a valid template for the last block of the period so it can't mine until its clock catches up. This is mostly a theoretical concern on mainnet because it would require a huge system clock misconfiguration. It might be a bigger concern on test networks with volatile hashrates. But generally, I think our miner should be able to create valid templates in any situation.

  2. DrahtBot added the label Mining on Aug 11, 2026
  3. DrahtBot commented at 1:36 PM on August 11, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/35949.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process.

    Type Reviewers
    ACK kevkevinpal
    Concept ACK l0rinc, Sjors

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  4. DrahtBot added the label CI failed on Aug 11, 2026
  5. l0rinc commented at 6:08 PM on August 11, 2026: contributor

    Concept ACK for implementing and for doing it independently of the consensus change! (note that the build failure seems directly related to the change)

  6. in test/functional/mining_basic.py:289 in 054459f3e2
     284 | +        block.solve()
     285 | +        node.submitheader(hexdata=CBlockHeader(block).serialize().hex())
     286 | +
     287 | +        bad_block = create_block(tmpl=tmpl, ntime=first_block_time - 1)
     288 | +        bad_block.solve()
     289 | +        assert_raises_rpc_error(-25, 'time-negative-interval', lambda: node.submitheader(hexdata=CBlockHeader(bad_block).serialize().hex()))
    


    kevkevinpal commented at 1:24 PM on August 12, 2026:

    This submitheader / time-negative-interval assert depends on BIP54 consensus from #35793, which isn’t on master yet, so it breaks CI. We should comment out as a TODO here.

    Re-add the reject check once #35793 is merged, or we can add more logic from that PR to satisfy this assertion.


    fjahr commented at 8:52 AM on August 15, 2026:

    Thanks for the hint! I removed the assertion here instead of commenting it out: it tests the consensus rule enforcement rather than the miner change, and #35793 already covers that path itself actually well enough in the functional test. So if this were to be uncommented with the introduction of the consensus rules, the would be no additional coverage afaict.

  7. kevkevinpal commented at 1:29 PM on August 12, 2026: contributor

    Concept ACK, thanks for picking this up!

    As L0rinc said, the CI failure appears to be related to the change. I added a comment on where the failure is coming from and suggested either adding a TODO comment or adding more logic to satisfy that test.

  8. miner: Enforce murch-zawy rule (BIP54) e014e5bb61
  9. fjahr force-pushed on Aug 15, 2026
  10. DrahtBot removed the label CI failed on Aug 15, 2026
  11. kevkevinpal commented at 12:38 AM on August 17, 2026: contributor

    crACK e014e5b

  12. DrahtBot requested review from l0rinc on Aug 17, 2026
  13. Sjors commented at 4:43 PM on August 19, 2026: member

    Concept ACK


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-08-21 04:51 UTC

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