-
Notifications
You must be signed in to change notification settings - Fork 36.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove buggy and confusing IncrementExtraNonce #24732
The head ref may contain hidden characters: "2204-remove-code-\u{1F317}"
Conversation
fa7624f
to
faf8e55
Compare
faf8e55
to
fa38b1c
Compare
Concept ACK, nice cleanup. |
Concept ACK |
1 similar comment
Concept ACK |
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
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. |
Code review ACK fa38b1c |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK fa38b1c
Removed more code |
ACK cccc4e8 |
The RPC should probably throw an error if |
Yeah, and also when |
bitcoin/bitcoin#24732 changes how new blocks are mined in regtest, which changes all the txids for our regtest transactions. I ran: t/online_regtest_wallet.py recreate-all-tests All of these tests are failing now because the golden no longer matches, which I will update next, but I first wanted to commit the automated step here separately. t/create-withdrawal-data.address-needs-correction.run required hand-editing because the input transaction appears twice.
Created by running `make remake`. All tests passing again on bitcoin built from 79bf1a0fa2c72911bb964f7303dd3acee3db584f (just after bitcoin/bitcoin#24732 was merged).
bitcoin/bitcoin#24732 changes the coinbase output of new blocks in regtest, which changes all the txids for our regtest transactions. I ran: t/online_regtest_wallet.py recreate-all-tests make remake t/create-withdrawal-data.address-needs-correction.run required hand-editing because the input transaction appears twice.
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 bitcoin/bitcoin@fad84b7 (*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 [[bitcoin/bitcoin#24732 | 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
IncrementExtraNonce has many issues:
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.