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

Fix testnet ASERTDaa anchor #271

Merged
merged 4 commits into from
Jan 27, 2023
Merged

Conversation

PiRK
Copy link
Collaborator

@PiRK PiRK commented Jan 27, 2023

This fixes a regression preventing header synchronization for testnet3 after the previous checkpoint bump. The checkpoint was bumped after the ASERT anchor, which made the automatic computation of the Anchor not work for new users because of missing headers.

Fix header synchronization by explicitly specifying the anchor parameters.

This was not detected before because the bug did not manifest itself if all the headers were already present locally.

PiRK and others added 4 commits January 27, 2023 08:47
It had the wrong value. Source:
https://gitlab.com/bitcoin-cash-node/bitcoin-cash-node/-/blob/master/src/chainparams.cpp#L348

It didn't matter that it had the wrong value since it was behind a
checkpoint.  But still, it is worth fixing.
Previously I didn't backport the testnet changes for Electron-Cash@3f63318

> The issues manifests itself whenever the checkpoint block is after
> the asert anchor. This caused the code in blockchain.py to have a bad time.
>
> The asert anchor calculation code needs all headers, but if we have a
> checkpoint after the anchor, all headers are not always available. The fix
> is to either have checkpoints before the anchor, or to hard-code the anchor.
>
> This is the case for all chains we support now.

It broke headers synchronization when I set a new tesnet checkpoint on November 15th 2021, but I didn't notice because I already had a complete header chain so it did not trigger the bug for me. But for a user who does not already have the headers prior to the checkpoint locally, it causes the headers synchronization to fail.
The difficulty adjustment for eCash testnet has the same half-life as for eCash MainNet. This paramameter is only used on the BCH chain.

This is a follow-up to commit bf82557
@PiRK PiRK merged commit 4e8dc93 into Bitcoin-ABC:master Jan 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants