]>
Commit | Line | Data |
---|---|---|
df852d2b | 1 | // Copyright (c) 2009-2010 Satoshi Nakamoto |
f914f1a7 | 2 | // Copyright (c) 2009-2014 The Bitcoin Core developers |
78253fcb | 3 | // Distributed under the MIT software license, see the accompanying |
bc909a7a | 4 | // file COPYING or https://www.opensource.org/licenses/mit-license.php . |
df852d2b | 5 | |
6 | #ifndef BITCOIN_POW_H | |
7 | #define BITCOIN_POW_H | |
8 | ||
4b729ec5 | 9 | #include "chain.h" |
d698ef69 JT |
10 | #include "consensus/params.h" |
11 | ||
df852d2b | 12 | #include <stdint.h> |
13 | ||
df852d2b | 14 | class CBlockHeader; |
611116d4 | 15 | class CBlockIndex; |
fdda3c50 | 16 | class CChainParams; |
df852d2b | 17 | class uint256; |
734f85c4 | 18 | class arith_uint256; |
df852d2b | 19 | |
90198f71 | 20 | #define VERUSHASH2_SHIFT 9 |
21 | ||
d698ef69 | 22 | unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params&); |
29842505 JG |
23 | unsigned int CalculateNextWorkRequired(arith_uint256 bnAvg, |
24 | int64_t nLastBlockTime, int64_t nFirstBlockTime, | |
b30ff0d3 | 25 | const Consensus::Params&, |
74212727 | 26 | int nextHeight); |
df852d2b | 27 | |
1f722359 MT |
28 | unsigned int lwmaGetNextPOSRequired(const CBlockIndex* pindexLast, const Consensus::Params& params); |
29 | ||
fdda3c50 | 30 | /** Check whether the Equihash solution in a block header is valid */ |
cea06a4f | 31 | bool CheckEquihashSolution(const CBlockHeader *pblock, const Consensus::Params&); |
fdda3c50 | 32 | |
df852d2b | 33 | /** Check whether a block hash satisfies the proof-of-work requirement specified by nBits */ |
1f722359 | 34 | bool CheckProofOfWork(const CBlockHeader &blkHeader, uint8_t *pubkey33, int32_t height, const Consensus::Params& params); |
4b729ec5 | 35 | CChainPower GetBlockProof(const CBlockIndex& block); |
b343c1a1 | 36 | |
f7303f97 PW |
37 | /** Return the time it would take to redo the work difference between from and to, assuming the current hashrate corresponds to the difficulty at tip, in seconds. */ |
38 | int64_t GetBlockProofEquivalentTime(const CBlockIndex& to, const CBlockIndex& from, const CBlockIndex& tip, const Consensus::Params&); | |
39 | ||
093303a8 | 40 | #endif // BITCOIN_POW_H |