Skip to content
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

Disable retargeting on regtest to preserve compatibility with bitcoind #256

Closed
wants to merge 1 commit into from

Conversation

amanzag
Copy link

@amanzag amanzag commented Aug 3, 2022

No description provided.

@buck54321
Copy link
Contributor

I think this could possibly resolve #211 and #255. @Roasbeef, can we get some action on this?

@@ -2736,6 +2736,11 @@ func (b *blockManager) checkHeaderSanity(blockHeader *wire.BlockHeader,
func (b *blockManager) calcNextRequiredDifficulty(newBlockTime time.Time,
reorgAttempt bool) (uint32, error) {

// bitcoind doesn't do retargeting on regtest, we do the same to ensure compatibility
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks a bit hacky indeed... bitcoind solved it by adding another boolean to the chain params: https://github.com/bitcoin/bitcoin/blob/e695d8536e534f1e59de4a62a0d87a93e7a73456/src/kernel/chainparams.cpp#L415
Perhaps we should do the same in btcd? Then we could solve it for both Neutrino and btcd.

Copy link
Contributor

@chappjc chappjc Jun 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be straightforward since blockManagerCfg has the params stored.

For reference: https://github.com/bitcoin/bitcoin/pull/6853/files

Would you be able to tweak this PR like that @amanzag? Thanks so much for addressing this inconsistency with bitcoind.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a PR up in btcd that can be re-used here once merged: btcsuite/btcd#1985

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed that, Great!

@lightninglabs-deploy
Copy link

@Crypt-iQ: review reminder
@amanzag, remember to re-request review from reviewers when ready

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants