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. See #24730 (comment)
- 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 thegenerate*
RPCs once every second, to use the timestamp as extra nonce.