Bitcoin ABC 0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
pow.h
Go to the documentation of this file.
1// Copyright (c) 2009-2010 Satoshi Nakamoto
2// Copyright (c) 2009-2016 The Bitcoin Core developers
3// Distributed under the MIT software license, see the accompanying
4// file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
6#ifndef BITCOIN_POW_POW_H
7#define BITCOIN_POW_POW_H
8
9#include <cstdint>
10
11class arith_uint256;
12struct BlockHash;
13class CBlockHeader;
14class CBlockIndex;
15class CChainParams;
16
17namespace Consensus {
18struct Params;
19}
20
22 const CBlockHeader *pblock,
23 const CChainParams &chainParams);
24
29bool CheckProofOfWork(const BlockHash &hash, uint32_t nBits,
30 const Consensus::Params &params);
31
53
57bool NBitsToTarget(const Consensus::Params &params, uint32_t nBits,
59
60#endif // BITCOIN_POW_POW_H
const CChainParams & Params()
Return the currently selected parameters.
Nodes collect new transactions into a block, hash them into a hash tree, and scan through nonce value...
Definition block.h:23
The block chain is a tree shaped structure starting with the genesis block at the root,...
Definition blockindex.h:25
CChainParams defines various tweakable parameters of a given instance of the Bitcoin system.
Definition chainparams.h:80
256-bit unsigned big integer.
bool CheckProofOfWork(const BlockHash &hash, uint32_t nBits, const Consensus::Params &params)
Check whether a block hash satisfies the proof-of-work requirement specified by nBits.
Definition pow.cpp:87
bool PermittedDifficultyTransition(const Consensus::Params &params, int64_t height, uint32_t old_nbits, uint32_t new_nbits)
Return false if the proof-of-work requirement specified by new_nbits at a given height is not possibl...
Definition pow.cpp:47
uint32_t GetNextWorkRequired(const CBlockIndex *pindexPrev, const CBlockHeader *pblock, const CChainParams &chainParams)
Definition pow.cpp:21
bool NBitsToTarget(const Consensus::Params &params, uint32_t nBits, arith_uint256 &target)
Convert a header bits difficulty representation to a 256 bits hash target.
Definition pow.cpp:102
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
Definition random.h:85
A BlockHash is a unqiue identifier for a block.
Definition blockhash.h:13
Parameters that influence chain consensus.
Definition params.h:34