The main and test networks are configured to use parameters that are currently low-memory but usable with the basic solver; they will be increased once the solver is optimised. The regtest network is configured to have extremely low memory usage for speed. Note that Bitcoin's double-hasher is used for the difficulty check. This does not match the paper, but is simpler than changing the block header serialization. Single hashing is kept for the EquiHash solver because there is no requirement on execution time there, only on memory usage.
33 lines
1.3 KiB
C++
33 lines
1.3 KiB
C++
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
|
// Copyright (c) 2009-2014 The Bitcoin Core developers
|
|
// Distributed under the MIT software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#ifndef BITCOIN_POW_H
|
|
#define BITCOIN_POW_H
|
|
|
|
#include "consensus/params.h"
|
|
|
|
#include <stdint.h>
|
|
|
|
class CBlockHeader;
|
|
class CBlockIndex;
|
|
class CChainParams;
|
|
class uint256;
|
|
class arith_uint256;
|
|
|
|
unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params&);
|
|
unsigned int CalculateNextWorkRequired(const CBlockIndex* pindexLast, int64_t nFirstBlockTime, const Consensus::Params&);
|
|
|
|
/** Check whether the Equihash solution in a block header is valid */
|
|
bool CheckEquihashSolution(const CBlockHeader *pblock, const CChainParams&);
|
|
|
|
/** Check whether a block hash satisfies the proof-of-work requirement specified by nBits */
|
|
bool CheckProofOfWork(uint256 hash, unsigned int nBits, const Consensus::Params&);
|
|
arith_uint256 GetBlockProof(const CBlockIndex& block);
|
|
|
|
/** 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. */
|
|
int64_t GetBlockProofEquivalentTime(const CBlockIndex& to, const CBlockIndex& from, const CBlockIndex& tip, const Consensus::Params&);
|
|
|
|
#endif // BITCOIN_POW_H
|