PRCYCoin  2.0.0.7rc1
P2P Digital Currency
poa.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2014 The Bitcoin developers
3 // Copyright (c) 2018-2019 The DAPS Project developers
4 // Copyright (c) 2020-2022 The PRivaCY Coin Developers
5 // Distributed under the MIT/X11 software license, see the accompanying
6 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
7 
8 #ifndef BITCOIN_POA_H
9 #define BITCOIN_POA_H
10 
11 #include <stdint.h>
12 #include <primitives/block.h>
13 
14 class CBlockHeader;
15 class CBlockIndex;
16 class uint256;
17 class arith_uint256;
18 
19 // Define difficulty retarget algorithms
20 enum DiffMode {
21  DIFF_DEFAULT = 0, // Default to invalid 0
22  DIFF_BTC = 1, // Retarget every x blocks (Bitcoin style)
23  DIFF_KGW = 2, // Retarget using Kimoto Gravity Well
24  DIFF_DGW = 3, // Retarget using Dark Gravity Wave v3
25 };
26 
27 unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader* pblock);
28 
30 bool CheckProofOfWork(uint256 hash, unsigned int nBits);
31 uint256 GetBlockProof(const CBlockIndex& block);
32 
33 extern unsigned int N_BITS;
34 
35 //Check PoA block header consensus rules
36 bool CheckPrevPoABlockHash(const CBlockHeader& block);
37 
38 bool CheckPoAMerkleRoot(const CBlock& block, bool* fMutate = NULL);
39 
41 bool CheckPoABlockMinedHash(const CBlockHeader& block);
42 
43 bool CheckPoAContainRecentHash(const CBlock& block);
44 bool CheckNumberOfAuditedPoSBlocks(const CBlock& block, const CBlockIndex* pindex);
45 bool CheckPoABlockNotContainingPoABlockInfo(const CBlock& block, const CBlockIndex* pindex);
46 
47 bool CheckPoAblockTime(const CBlock& block);
48 bool CheckPoABlockNotAuditingOverlap(const CBlock& block);
49 bool CheckPoABlockRewardAmount(const CBlock& block, const CBlockIndex* pindex);
50 bool CheckPoABlockPaddingAmount(const CBlock& block, const CBlockIndex* pindex);
51 bool IsFixedAudit(std::string txid, int nHeight);
52 bool IsWrongAudit(std::string txid, int nHeight);
53 
54 #endif // BITCOIN_POA_H
DIFF_DGW
@ DIFF_DGW
Definition: poa.h:24
block.h
IsWrongAudit
bool IsWrongAudit(std::string txid, int nHeight)
Definition: poa.cpp:540
CBlockHeader
Nodes collect new transactions into a block, hash them into a hash tree, and scan through nonce value...
Definition: block.h:52
CheckProofOfWork
bool CheckProofOfWork(uint256 hash, unsigned int nBits)
Check whether a block hash satisfies the proof-of-work requirement specified by nBits.
Definition: poa.cpp:145
CheckNumberOfAuditedPoSBlocks
bool CheckNumberOfAuditedPoSBlocks(const CBlock &block, const CBlockIndex *pindex)
Definition: poa.cpp:314
arith_uint256
256-bit unsigned big integer.
Definition: arith_uint256.h:340
DiffMode
DiffMode
Definition: poa.h:20
DIFF_DEFAULT
@ DIFF_DEFAULT
Definition: poa.h:21
CheckPoAContainRecentHash
bool CheckPoAContainRecentHash(const CBlock &block)
Definition: poa.cpp:192
CheckPoABlockPaddingAmount
bool CheckPoABlockPaddingAmount(const CBlock &block, const CBlockIndex *pindex)
Definition: poa.cpp:500
CheckPoAMerkleRoot
bool CheckPoAMerkleRoot(const CBlock &block, bool *fMutate=NULL)
Definition: poa.cpp:390
uint256
256-bit unsigned big integer.
Definition: uint256.h:38
N_BITS
unsigned int N_BITS
Definition: poa.cpp:20
DIFF_KGW
@ DIFF_KGW
Definition: poa.h:23
CheckPoABlockNotAuditingOverlap
bool CheckPoABlockNotAuditingOverlap(const CBlock &block)
Definition: poa.cpp:445
CBlock
Definition: block.h:142
CheckPoABlockRewardAmount
bool CheckPoABlockRewardAmount(const CBlock &block, const CBlockIndex *pindex)
Definition: poa.cpp:483
CheckPoABlockMinedHash
bool CheckPoABlockMinedHash(const CBlockHeader &block)
Check whether a block hash satisfies the proof-of-work requirement specified by nBits.
Definition: poa.cpp:331
CheckPrevPoABlockHash
bool CheckPrevPoABlockHash(const CBlockHeader &block)
Definition: poa.cpp:359
DIFF_BTC
@ DIFF_BTC
Definition: poa.h:22
GetNextWorkRequired
unsigned int GetNextWorkRequired(const CBlockIndex *pindexLast, const CBlockHeader *pblock)
Definition: poa.cpp:24
IsFixedAudit
bool IsFixedAudit(std::string txid, int nHeight)
Definition: poa.cpp:534
CBlockIndex
The block chain is a tree shaped structure starting with the genesis block at the root,...
Definition: chain.h:162
CheckPoAblockTime
bool CheckPoAblockTime(const CBlock &block)
Definition: poa.cpp:422
CheckPoABlockNotContainingPoABlockInfo
bool CheckPoABlockNotContainingPoABlockInfo(const CBlock &block, const CBlockIndex *pindex)
Definition: poa.cpp:400
GetBlockProof
uint256 GetBlockProof(const CBlockIndex &block)
Definition: poa.cpp:171