expected_difficulty_threshold has no Regtest case — only the testnet minimum-difficulty branch, else full retargeting:
|
pub fn expected_difficulty_threshold(&self) -> CompactDifficulty { |
|
if NetworkUpgrade::is_testnet_min_difficulty_block( |
|
&self.network, |
|
self.candidate_height, |
|
self.candidate_time, |
|
*self.relevant_times.first(), |
|
) { |
|
assert!( |
|
self.network.is_a_test_network(), |
|
"invalid network: the minimum difficulty rule only applies on test networks" |
|
); |
|
self.network.target_difficulty_limit().to_compact() |
|
} else { |
|
self.threshold_bits() |
|
} |
|
} |
zcashd regtest uses fixed powLimit with no retargeting (fPowNoRetargeting). Once the difficulty-averaging window fills (~17 blocks), the nBits of blocks mined on a zakura regtest chain diverge from powLimit, and a following zcashd rejects the headers as bad-diffbits — a permanent fork at that height. -regtestacceptunvalidatedpow does not help: it skips equihash/block-hash checks, not the contextual nBits check.
Regtest-only; no mainnet impact. It does prevent any regtest test that mines more than ~17 blocks (e.g. coinbase-maturity flows, which need 100+) from working with a zcashd sidecar.
Reproduce: mine ~20 regtest blocks on zakurad with a zcashd sidecar following; the sidecar rejects the first post-window header with bad-diffbits and stops following.
Fix reference: fixed upstream in Zebra (ZcashFoundation/zebra#10952, commit c7691893e): pin every Regtest block to the target difficulty limit, matching zcashd's fPowNoRetargeting.
expected_difficulty_thresholdhas no Regtest case — only the testnet minimum-difficulty branch, else full retargeting:zakura/zakura-state/src/service/check/difficulty.rs
Lines 188 to 203 in 7880676
zcashd regtest uses fixed powLimit with no retargeting (
fPowNoRetargeting). Once the difficulty-averaging window fills (~17 blocks), thenBitsof blocks mined on a zakura regtest chain diverge from powLimit, and a following zcashd rejects the headers asbad-diffbits— a permanent fork at that height.-regtestacceptunvalidatedpowdoes not help: it skips equihash/block-hash checks, not the contextualnBitscheck.Regtest-only; no mainnet impact. It does prevent any regtest test that mines more than ~17 blocks (e.g. coinbase-maturity flows, which need 100+) from working with a zcashd sidecar.
Reproduce: mine ~20 regtest blocks on zakurad with a zcashd sidecar following; the sidecar rejects the first post-window header with
bad-diffbitsand stops following.Fix reference: fixed upstream in Zebra (ZcashFoundation/zebra#10952, commit c7691893e): pin every Regtest block to the target difficulty limit, matching zcashd's
fPowNoRetargeting.