Bitcoin difficulty re targeting in case of catastrophic hashrate drop?

1

I do understand that the mining difficulty changes every 2016 blocks :

next_difficulty = (previous_difficulty * 2016 * 10 minutes) / (time to mine last 2016 blocks)

But how is difficulty changes if suddenly 90% of hash rate disappears* ? I would be very grateful if someone could kindly point me to the class in sources.

*recent BCH fork had difficulty adjusted quicker than 2016 blocks.

P.S. Should I be looking at

unsigned int CalculateNextWorkRequired(const CBlockIndex* pindexLast, int64_t nFirstBlockTime, const Consensus::Params& params)

in pow.cpp ?

CryingHippo

Posted 2017-08-22T17:07:25.903

Reputation: 113

Answers

3

But how is difficulty changes if suddenly 90% of hash rate disappears* ?

It will change as it normally does, after 2016 blocks. There is no provision for adjusting the difficulty if the hashrate suddenly drops.

*recent BCH fork had difficulty adjusted quicker than 2016 blocks.

As part of their hard fork, they added a provision for cases where blocks are taking too long (i.e. sudden hashrate drop). This extra difficulty changing rule is not present in Bitcoin.

Andrew Chow

Posted 2017-08-22T17:07:25.903

Reputation: 40 910