Median Block Selection for DAA now follows ABC algorithm. #12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The median Block selection algorithm for the Difficulty Adjustment Algorithm now follows the expanded footprints specified in the specification.
The median selection algorithm previously used a descending order stable sort algorithm via a custom Comparitor on the Block's Timestamp. This operation is inconsistent with ABC's implementation when 2 of the 3 Blocks have the same Timestamp value, which causes the node to select a different median Block with a different ChainWork value, ultimately hypothetically leading to a different difficulty calculation.
This implementation difference was never encountered on main net. Although the likeliness of encountering this edge case is rare, all nodes should upgrade to the next release containing this patch as it would result in a chain split if encountered.
This bug fix is in response to Issue #11 . His commentary is located in more depth here: https://read.cash/@Fernando/on-daa-implementation-algorithms-and-specifications-b739e631