-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
blockchain+chaincfg: disable retargeting for regtest #1985
Conversation
Pull Request Test Coverage Report for Build 5342782675
💛 - Coveralls |
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.
Thanks for picking this up! Something I also wanted to do as it can save us quite some blocks in lnd
's itest!
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.
Looks ok otherwise
|
||
// Emulate the same behavior as Bitcoin Core that for regtest there is | ||
// no difficulty retargeting. | ||
if b.chainParams.PoWNoRetargeting { |
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.
Since this is only desired for Regtest (maybe simnet in btcd as well?), how about something like:
if b.chainParams.Name == chaincfg.RegressionNetParams.Name {
instead of introducing a new field in Params
?.
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.
IMO this makes it just way more explicit what's going on. See lightninglabs/neutrino#256 (comment) 😅
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.
Ah. Ok seems alright
ACK cf802a0 |
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.
LGTM. Just a note about the initial objections from @davecgh, but I think the ship has sailed on this since it's what bitcoind does and apps like neutrino need to match.
FWIW simnet does do retargeting, so applications that depend on being able to replicate such behavior can use that in place. |
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.
LGTM 💫
Needs rebase.
This commit emulates the behavior of Bitcoin Core introduced in bitcoin/bitcoin#6853 that disables retargeting of the required proof of work for regtest.
cf802a0
to
599d361
Compare
This commit emulates the behavior of Bitcoin Core introduced in bitcoin/bitcoin#6853 that disables retargeting of the required proof of work for regtest.
Attempts to fix lightninglabs/neutrino#256 in a less hacky way (needs a PR in that repo as well after this one has been merged).