From 54b20fd87ab843fcc7a86ff463ec84ab862fd5ab Mon Sep 17 00:00:00 2001 From: Ross Nicoll Date: Tue, 18 Apr 2017 19:15:10 +0100 Subject: Add Dogecoin difficulty calculations --- src/dogecoin.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/dogecoin.h') diff --git a/src/dogecoin.h b/src/dogecoin.h index d834372a0..ccd0ef3e0 100644 --- a/src/dogecoin.h +++ b/src/dogecoin.h @@ -2,7 +2,9 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. +#include "chain.h" #include "chainparams.h" #include "amount.h" CAmount GetDogecoinBlockSubsidy(int nHeight, const Consensus::Params& consensusParams, uint256 prevHash); +unsigned int CalculateDogecoinNextWorkRequired(const CBlockIndex* pindexLast, int64_t nLastRetargetTime, const Consensus::Params& params); -- cgit v1.2.3 From ce564e381aba126dbfc33a26184a4b8e1e3b077c Mon Sep 17 00:00:00 2001 From: Ross Nicoll Date: Tue, 16 Oct 2018 22:38:56 +0000 Subject: Merge AuxPoW support from Namecore Changes are as below: Wrap CBlockHeader::nVersion into a new class (CBlockVersion). This allows to take care of interpreting the field into a base version, auxpow flag and the chain ID. Update getauxblock.py for new 'generate' RPC call. Add 'auxpow' to block JSON. Accept auxpow as PoW verification. Add unit tests for auxpow verification. Add check for memory-layout of CBlockVersion. Weaken auxpow chain ID checks for the testnet. Allow Params() to overrule when to check the auxpow chain ID and for legacy blocks. Use this to disable the checks on testnet. Introduce CPureBlockHeader. Split the block header part that is used by auxpow and the "real" block header (that uses auxpow) to resolve the cyclic dependency between the two. Differentiate between uint256 and arith_uint256. This change was done upstream, modify the auxpow code. Add missing lock in auxpow_tests. Fix REST header check for auxpow headers. Those can be longer, thus take that into account. Also perform the check actually on an auxpow header. Correctly set the coinbase for getauxblock results. Call IncrementExtraNonce in getauxblock so that the coinbase is actually initialised with the stuff it should be. (BIP30 block height and COINBASE_FLAGS.) Implement getauxblock plus regression test. Turn auxpow test into FIXTURE test. This allows using of the Params() calls. Move CMerkleTx code to auxpow.cpp. Otherwise we get linker errors when building without wallet. Fix rebase with BIP66. Update the code to handle BIP66's nVersion=3. Enforce that auxpow parent blocks have no auxpow block version. This is for compatibility with namecoind. See also https://github.com/namecoin/namecoin/pull/199. Move auxpow-related parameters to Consensus::Params. --- src/dogecoin.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/dogecoin.h') diff --git a/src/dogecoin.h b/src/dogecoin.h index ccd0ef3e0..1adbc1925 100644 --- a/src/dogecoin.h +++ b/src/dogecoin.h @@ -2,9 +2,17 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. +#include "amount.h" #include "chain.h" #include "chainparams.h" -#include "amount.h" CAmount GetDogecoinBlockSubsidy(int nHeight, const Consensus::Params& consensusParams, uint256 prevHash); unsigned int CalculateDogecoinNextWorkRequired(const CBlockIndex* pindexLast, int64_t nLastRetargetTime, const Consensus::Params& params); + +/** + * Check proof-of-work of a block header, taking auxpow into account. + * @param block The block header. + * @param params Consensus parameters. + * @return True iff the PoW is correct. + */ +bool CheckAuxPowProofOfWork(const CBlockHeader& block, const Consensus::Params& params); -- cgit v1.2.3 From 3f788348e1621457629cce8d891b0ea459af7317 Mon Sep 17 00:00:00 2001 From: Ross Nicoll Date: Sun, 24 Sep 2017 15:56:19 +0100 Subject: Sync changes from Dogecoin 1.10 --- src/dogecoin.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/dogecoin.h') diff --git a/src/dogecoin.h b/src/dogecoin.h index 1adbc1925..403673da5 100644 --- a/src/dogecoin.h +++ b/src/dogecoin.h @@ -6,6 +6,7 @@ #include "chain.h" #include "chainparams.h" +bool AllowDigishieldMinDifficultyForBlock(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params& params); CAmount GetDogecoinBlockSubsidy(int nHeight, const Consensus::Params& consensusParams, uint256 prevHash); unsigned int CalculateDogecoinNextWorkRequired(const CBlockIndex* pindexLast, int64_t nLastRetargetTime, const Consensus::Params& params); -- cgit v1.2.3