[x] Devnet, Testnet and Mainnet chain synchronize.
[x] I have resolved any merge conflicts.
This fixes incompatibility of difficulty calculation between core-rs and the reference implementation (core)
What's in this pull request?
Implements type FixedUnsigned with compile-time scaling. Precision is arbitrary, because BigUint is used internally. Only the number of decimal places is fixed.
Replaces Difficulty implementation to use FixedUnsigned10 (10 decimal places).
Fixes Blockchain::get_next_target to apply the adjustment exactly like the reference implementation using bignumber.js does.
Notes
This will break serialization compatibility
Run cargo bench -p fixed-unsigned to run benchmarks comparing FixedUnsigned to BigDecimal
Pull request checklist
This fixes incompatibility of difficulty calculation between
core-rs
and the reference implementation (core
)What's in this pull request?
FixedUnsigned
with compile-time scaling. Precision is arbitrary, becauseBigUint
is used internally. Only the number of decimal places is fixed.Difficulty
implementation to useFixedUnsigned10
(10 decimal places).Blockchain::get_next_target
to apply the adjustment exactly like the reference implementation usingbignumber.js
does.Notes
cargo bench -p fixed-unsigned
to run benchmarks comparingFixedUnsigned
toBigDecimal