Skip to content

Commit

Permalink
Merge pull request #17 from yangby-cryptape/bugfix/testnet-only
Browse files Browse the repository at this point in the history
fix: the next target for testnet
  • Loading branch information
yangby-cryptape authored Apr 22, 2024
2 parents 27953a4 + eeca5ae commit a13477b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion verifier/src/types/extension/packed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,10 @@ impl packed::SpvClient {
match (new_max_height + 1) % DIFFCHANGE_INTERVAL {
// Next block is the first block for a new difficulty.
0 => {
let prev_target = new_info.1.into();
// See the above check:
// - For mainnet, `header.bits` should be as the same as `new_info.1`.
// - But for testnet, it could be not.
let prev_target = header.bits.into();
let next_target =
calculate_next_target(prev_target, new_info.0, header.time);
new_info.1 = next_target.to_compact_lossy();
Expand Down

0 comments on commit a13477b

Please sign in to comment.