HomePhabricator

Remove buggy and confusing IncrementExtraNonce

Description

Remove buggy and confusing IncrementExtraNonce

Summary:
PR description:

IncrementExtraNonce has many issues:

  • It is test-only code, but part of bitcoind
  • It is using the block height of the tip, as opposed to the block's previous block as reference for the new height.
  • It has no use case in regtest testing. With a low difficulty the extra nonce won't be incremented. With a high difficulty the test-only functions are clumsy to handle anyway. For example, the generate* RPCs will return an empty array once they reached maxtries, as opposed to an error. Also the calls can't be aborted early unless the node shuts down completely. So I think it is fine to just remove the extra nonce functionality and leave it to the outside to implement, if needed. For example, a wrapper script can call the generate* RPCs once every second, to use the timestamp as extra nonce.

Note that core did not need to update m_assumeutxo_data because their TestChain100Setup no longer used IncrementExtraNonce since https://github.com/bitcoin/bitcoin/pull/19775/commits/fad84b7e14ff92465bc17bfdaf1362bcffe092f6 (*test: Activate segwit in TestChain100Setup*)

The changes in feature_utxo_set_hash are not relevant for now as we are still checking the hashes generated from the chain loaded from cache (we are missing the core#21390 ackport).

This is a backport of core#24732

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D14312

Details

Provenance
MarcoFalke <falke.marco@gmail.com>Authored on Apr 1 2022, 08:26
PiRKCommitted on Jul 27 2023, 05:27
PiRKPushed on Jul 27 2023, 05:27
Reviewer
Restricted Project
Differential Revision
D14312: Remove buggy and confusing IncrementExtraNonce
Parents
rABC5d3b32b31735: [Automated] Update timing.json
Branches
Unknown
Tags
Unknown