Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Testnet difficulty calculation changes, to take effect Feb 15 2012 #686
Allow mining of min-difficulty blocks if 20 minutes have gone by without mining a regular-difficulty block.
This will almost certainly cause a testnet blockchain split after Jan 15. I'll update the Testnet Faucet, I'll ask theymos if he can update the testnet block explorer bitcoind.
(date slipped from Jan 1 to Feb 15)
RE: why keep the regular-difficulty-every-2016-blocks:
Because if you don't, and hashing power drops, then it will never adjust downward properly because the common case for non-cusp blocks is "find the last block with something other than minimum work and return its difficulty."
Example: Imagine difficulty is at 1111 before block 201600, and that block ends up taking 60 minutes to find. Imagine the normal difficulty adjustment would drop difficulty to 600.
If we allow block 201600 to have difficulty 1, then block 201601 would also be looked for at difficulty 1111, because there's no previous block with the new difficulty.
I wrote the code that way so testnet is as close to mainnet as possible; I didn't want a completely different testnet non-cusp-block calculation (yes, I COULD figure out what the last difficulty adjustment interval was and factor out the difficulty computation into yet another method... benefit doesn't seem worth the extra code complexity).
RE: adjusting testnet base58 version: okey doke. What's the right number for testnet under your scheme? 192?
coblee: Nice catch! You're right, this would prevent difficulty from ever dropping all the way down to min difficulty.
luke-jr: Nice catch! You're right, the orphan block DoS code needs to take into account this change.
I won't have time to fix this until I'm back next week.