mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
Add unit tests for next difficulty calculations
Split GetNextWorkRequired() into two functions to allow the difficulty calculations to be tested without requiring a full blockchain. Add unit tests to cover basic difficulty calculation, plus each of the min/max actual time, and maximum difficulty target conditions.
This commit is contained in:
@@ -14,6 +14,7 @@ class uint256;
|
||||
class arith_uint256;
|
||||
|
||||
unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock);
|
||||
unsigned int CalculateNextWorkRequired(const CBlockIndex* pindexLast, int64_t nFirstBlockTime);
|
||||
|
||||
/** Check whether a block hash satisfies the proof-of-work requirement specified by nBits */
|
||||
bool CheckProofOfWork(uint256 hash, unsigned int nBits);
|
||||
|
||||
Reference in New Issue
Block a user