From 54b20fd87ab843fcc7a86ff463ec84ab862fd5ab Mon Sep 17 00:00:00 2001 From: Ross Nicoll Date: Tue, 18 Apr 2017 19:15:10 +0100 Subject: [PATCH 1/6] Add Dogecoin difficulty calculations --- src/dogecoin.cpp | 61 ++++++++++++++++++++++++ src/dogecoin.h | 2 + src/pow.cpp | 3 +- src/test/dogecoin_tests.cpp | 95 +++++++++++++++++++++++++++++++++++-- 4 files changed, 157 insertions(+), 4 deletions(-) diff --git a/src/dogecoin.cpp b/src/dogecoin.cpp index 77a8a0093..dac5cc00a 100644 --- a/src/dogecoin.cpp +++ b/src/dogecoin.cpp @@ -5,7 +5,9 @@ #include #include +#include "arith_uint256.h" #include "dogecoin.h" +#include "util.h" int static generateMTRandom(unsigned int s, int range) { @@ -14,6 +16,65 @@ int static generateMTRandom(unsigned int s, int range) return dist(gen); } +unsigned int CalculateDogecoinNextWorkRequired(const CBlockIndex* pindexLast, int64_t nFirstBlockTime, const Consensus::Params& params) +{ + int nHeight = pindexLast->nHeight + 1; + bool fNewDifficultyProtocol = (nHeight >= 145000); + // bool fNewDifficultyProtocol = (nHeight >= params.GetDigiShieldForkBlock()); + const int64_t retargetTimespan = fNewDifficultyProtocol + ? 60 // params.DigiShieldTargetTimespan() + : params.nPowTargetTimespan; + + const int64_t nActualTimespan = pindexLast->GetBlockTime() - nFirstBlockTime; + int64_t nModulatedTimespan = nActualTimespan; + int64_t nMaxTimespan; + int64_t nMinTimespan; + + if (fNewDifficultyProtocol) //DigiShield implementation - thanks to RealSolid & WDC for this code + { + // amplitude filter - thanks to daft27 for this code + nModulatedTimespan = retargetTimespan + (nModulatedTimespan - retargetTimespan) / 8; + + nMinTimespan = retargetTimespan - (retargetTimespan / 4); + nMaxTimespan = retargetTimespan + (retargetTimespan / 2); + } else if (nHeight > 10000) { + nMinTimespan = retargetTimespan / 4; + nMaxTimespan = retargetTimespan * 4; + } else if (nHeight > 5000) { + nMinTimespan = retargetTimespan / 8; + nMaxTimespan = retargetTimespan * 4; + } else { + nMinTimespan = retargetTimespan / 16; + nMaxTimespan = retargetTimespan * 4; + } + + // Limit adjustment step + if (nModulatedTimespan < nMinTimespan) + nModulatedTimespan = nMinTimespan; + else if (nModulatedTimespan > nMaxTimespan) + nModulatedTimespan = nMaxTimespan; + + // Retarget + const arith_uint256 bnPowLimit = UintToArith256(params.powLimit); + arith_uint256 bnNew; + arith_uint256 bnOld; + bnNew.SetCompact(pindexLast->nBits); + bnOld = bnNew; + bnNew *= nModulatedTimespan; + bnNew /= retargetTimespan; + + if (bnNew > bnPowLimit) + bnNew = bnPowLimit; + + /// debug print + LogPrintf("GetNextWorkRequired RETARGET\n"); + LogPrintf("params.nPowTargetTimespan = %d nActualTimespan = %d\n", params.nPowTargetTimespan, nActualTimespan); + LogPrintf("Before: %08x %s\n", pindexLast->nBits, bnOld.ToString()); + LogPrintf("After: %08x %s\n", bnNew.GetCompact(), bnNew.ToString()); + + return bnNew.GetCompact(); +} + CAmount GetDogecoinBlockSubsidy(int nHeight, const Consensus::Params& consensusParams, uint256 prevHash) { int halvings = nHeight / consensusParams.nSubsidyHalvingInterval; 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); diff --git a/src/pow.cpp b/src/pow.cpp index ab305649a..1b266f74a 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -50,7 +51,7 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead const CBlockIndex* pindexFirst = pindexLast->GetAncestor(nHeightFirst); assert(pindexFirst); - return CalculateNextWorkRequired(pindexLast, pindexFirst->GetBlockTime(), params); + return CalculateDogecoinNextWorkRequired(pindexLast, pindexFirst->GetBlockTime(), params); } unsigned int CalculateNextWorkRequired(const CBlockIndex* pindexLast, int64_t nFirstBlockTime, const Consensus::Params& params) diff --git a/src/test/dogecoin_tests.cpp b/src/test/dogecoin_tests.cpp index f1d60f709..b5d7716d5 100644 --- a/src/test/dogecoin_tests.cpp +++ b/src/test/dogecoin_tests.cpp @@ -83,7 +83,7 @@ BOOST_AUTO_TEST_CASE(subsidy_limit_test) CAmount nSubsidy = GetDogecoinBlockSubsidy(nHeight, params, prevHash); CAmount nExpectedSubsidy = (500000 >> (nHeight / 100000)) * COIN; BOOST_CHECK(MoneyRange(nSubsidy)); - BOOST_CHECK(nSubsidy == nExpectedSubsidy); + BOOST_CHECK_EQUAL(nSubsidy, nExpectedSubsidy); nSum += nSubsidy * nStepSize; } @@ -96,10 +96,99 @@ BOOST_AUTO_TEST_CASE(subsidy_limit_test) // Test reward at 600k+ is constant CAmount nConstantSubsidy = GetDogecoinBlockSubsidy(600000, params, prevHash); - BOOST_CHECK(nConstantSubsidy == 10000 * COIN); + BOOST_CHECK_EQUAL(nConstantSubsidy, 10000 * COIN); nConstantSubsidy = GetDogecoinBlockSubsidy(700000, params, prevHash); - BOOST_CHECK(nConstantSubsidy == 10000 * COIN); + BOOST_CHECK_EQUAL(nConstantSubsidy, 10000 * COIN); +} + +BOOST_AUTO_TEST_CASE(get_next_work_difficulty_limit) +{ + SelectParams(CBaseChainParams::MAIN); + const Consensus::Params& params = Params().GetConsensus(); + + CBlockIndex pindexLast; + int64_t nLastRetargetTime = 1386474927; // Block # 1 + + pindexLast.nHeight = 239; + pindexLast.nTime = 1386475638; // Block #239 + pindexLast.nBits = 0x1e0ffff0; + BOOST_CHECK_EQUAL(CalculateDogecoinNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1e00ffff); +} + +BOOST_AUTO_TEST_CASE(get_next_work_pre_digishield) +{ + SelectParams(CBaseChainParams::MAIN); + const Consensus::Params& params = Params().GetConsensus(); + + CBlockIndex pindexLast; + int64_t nLastRetargetTime = 1386942008; // Block 9359 + + pindexLast.nHeight = 9599; + pindexLast.nTime = 1386954113; + pindexLast.nBits = 0x1c1a1206; + BOOST_CHECK_EQUAL(CalculateDogecoinNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1c15ea59); +} + +BOOST_AUTO_TEST_CASE(get_next_work_digishield) +{ + SelectParams(CBaseChainParams::MAIN); + const Consensus::Params& params = Params().GetConsensus(); + + CBlockIndex pindexLast; + int64_t nLastRetargetTime = 1395094427; + + // First hard-fork at 145,000, which applies to block 145,001 onwards + pindexLast.nHeight = 145000; + pindexLast.nTime = 1395094679; + pindexLast.nBits = 0x1b499dfd; + BOOST_CHECK_EQUAL(CalculateDogecoinNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1b671062); +} + +BOOST_AUTO_TEST_CASE(get_next_work_digishield_modulated_upper) +{ + SelectParams(CBaseChainParams::MAIN); + const Consensus::Params& params = Params().GetConsensus(); + + CBlockIndex pindexLast; + int64_t nLastRetargetTime = 1395100835; + + // Test the upper bound on modulated time using mainnet block #145,107 + pindexLast.nHeight = 145107; + pindexLast.nTime = 1395101360; + pindexLast.nBits = 0x1b3439cd; + BOOST_CHECK_EQUAL(CalculateDogecoinNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1b4e56b3); +} + +BOOST_AUTO_TEST_CASE(get_next_work_digishield_modulated_lower) +{ + SelectParams(CBaseChainParams::MAIN); + const Consensus::Params& params = Params().GetConsensus(); + + CBlockIndex pindexLast; + int64_t nLastRetargetTime = 1395380517; + + // Test the lower bound on modulated time using mainnet block #149,423 + pindexLast.nHeight = 149423; + pindexLast.nTime = 1395380447; + pindexLast.nBits = 0x1b446f21; + BOOST_CHECK_EQUAL(CalculateDogecoinNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1b335358); +} + +BOOST_AUTO_TEST_CASE(get_next_work_digishield_rounding) +{ + SelectParams(CBaseChainParams::MAIN); + const Consensus::Params& params = Params().GetConsensus(); + + CBlockIndex pindexLast; + int64_t nLastRetargetTime = 1395094679; + + // Test case for correct rounding of modulated time - this depends on + // handling of integer division, and is not obvious from the code + pindexLast.nHeight = 145001; + pindexLast.nTime = 1395094727; + pindexLast.nBits = 0x1b671062; + BOOST_CHECK_EQUAL(CalculateDogecoinNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1b6558a4); } BOOST_AUTO_TEST_SUITE_END() From 2abbb9f0dad5a631ebaccc0b9cb7822a188fb68a Mon Sep 17 00:00:00 2001 From: langerhans Date: Thu, 25 Jun 2015 00:08:12 +0200 Subject: [PATCH 2/6] Update dependency builder and its packages to be ready for Dogecoin specifics --- build-aux/m4/bitcoin_qt.m4 | 8 ++++++-- depends/packages/bdb.mk | 11 ++++++----- depends/packages/openssl.mk | 4 ++-- depends/packages/qt.mk | 2 +- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/build-aux/m4/bitcoin_qt.m4 b/build-aux/m4/bitcoin_qt.m4 index 05df8621d..eb9ccbf61 100644 --- a/build-aux/m4/bitcoin_qt.m4 +++ b/build-aux/m4/bitcoin_qt.m4 @@ -138,6 +138,8 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[ AC_DEFINE(QT_QPA_PLATFORM_MINIMAL, 1, [Define this symbol if the minimal qt platform exists]) if test "x$TARGET_OS" = xwindows; then _BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)],[-lqwindows]) + _BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(QMinimalIntegrationPlugin)],[-lqminimal]) ++ _BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(QWindowsPrinterSupportPlugin)],[-lwindowsprintersupport]) AC_DEFINE(QT_QPA_PLATFORM_WINDOWS, 1, [Define this symbol if the qt platform is windows]) elif test "x$TARGET_OS" = xlinux; then _BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(QXcbIntegrationPlugin)],[-lqxcb -lxcb-static]) @@ -359,6 +361,7 @@ AC_DEFUN([_BITCOIN_QT_FIND_STATIC_PLUGINS],[ if test -d "$qt_plugin_path/accessible"; then QT_LIBS="$QT_LIBS -L$qt_plugin_path/accessible" fi + QT_LIBS="$QT_LIBS -L$qt_plugin_path/printsupport" if test "x$use_pkgconfig" = xyes; then : dnl m4_ifdef([PKG_CHECK_MODULES],[ @@ -428,7 +431,7 @@ dnl Outputs: have_qt_test and have_qt_dbus are set (if applicable) to yes|no. AC_DEFUN([_BITCOIN_QT_FIND_LIBS_WITH_PKGCONFIG],[ m4_ifdef([PKG_CHECK_MODULES],[ QT_LIB_PREFIX=Qt5 - qt5_modules="Qt5Core Qt5Gui Qt5Network Qt5Widgets" + qt5_modules="Qt5Core Qt5Gui Qt5Network Qt5Widgets Qt5PrintSupport" BITCOIN_QT_CHECK([ PKG_CHECK_MODULES([QT5], [$qt5_modules], [QT_INCLUDES="$QT5_CFLAGS"; QT_LIBS="$QT5_LIBS" have_qt=yes],[have_qt=no]) @@ -460,7 +463,7 @@ AC_DEFUN([_BITCOIN_QT_FIND_LIBS_WITHOUT_PKGCONFIG],[ TEMP_LIBS="$LIBS" BITCOIN_QT_CHECK([ if test "x$qt_include_path" != x; then - QT_INCLUDES="-I$qt_include_path -I$qt_include_path/QtCore -I$qt_include_path/QtGui -I$qt_include_path/QtWidgets -I$qt_include_path/QtNetwork -I$qt_include_path/QtTest -I$qt_include_path/QtDBus" + QT_INCLUDES="-I$qt_include_path -I$qt_include_path/QtCore -I$qt_include_path/QtGui -I$qt_include_path/QtWidgets -I$qt_include_path/QtNetwork -I$qt_include_path/QtTest -I$qt_include_path/QtDBus -I$qt_include_path/QtPrintSupport" CPPFLAGS="$QT_INCLUDES $CPPFLAGS" fi ]) @@ -502,6 +505,7 @@ AC_DEFUN([_BITCOIN_QT_FIND_LIBS_WITHOUT_PKGCONFIG],[ BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}Gui] ,[main],,BITCOIN_QT_FAIL(lib${QT_LIB_PREFIX}Gui not found))) BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}Network],[main],,BITCOIN_QT_FAIL(lib${QT_LIB_PREFIX}Network not found))) BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}Widgets],[main],,BITCOIN_QT_FAIL(lib${QT_LIB_PREFIX}Widgets not found))) + BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}PrintSupport],[main],,BITCOIN_QT_FAIL(lib${QT_LIB_PREFIX}PrintSupport not found))) QT_LIBS="$LIBS" LIBS="$TEMP_LIBS" diff --git a/depends/packages/bdb.mk b/depends/packages/bdb.mk index 6c9876c2c..0b7142d9a 100644 --- a/depends/packages/bdb.mk +++ b/depends/packages/bdb.mk @@ -1,8 +1,8 @@ package=bdb -$(package)_version=4.8.30 +$(package)_version=5.1.29 $(package)_download_path=http://download.oracle.com/berkeley-db $(package)_file_name=db-$($(package)_version).NC.tar.gz -$(package)_sha256_hash=12edc0df75bf9abd7f82f821795bcee50f42cb2e5f76a6a281b85732798364ef +$(package)_sha256_hash=08238e59736d1aacdd47cfb8e68684c695516c37f4fbe1b8267dde58dc3a576c $(package)_build_subdir=build_unix define $(package)_set_vars @@ -13,8 +13,9 @@ $(package)_cxxflags=-std=c++11 endef define $(package)_preprocess_cmds - sed -i.old 's/__atomic_compare_exchange/__atomic_compare_exchange_db/' dbinc/atomic.h && \ - sed -i.old 's/atomic_init/atomic_init_db/' dbinc/atomic.h mp/mp_region.c mp/mp_mvcc.c mp/mp_fget.c mutex/mut_method.c mutex/mut_tas.c && \ + sed -i.old 's/__atomic_compare_exchange/__atomic_compare_exchange_db/' src/dbinc/atomic.h && \ + sed -i.old 's/atomic_init/atomic_init_db/' src/dbinc/atomic.h src/mp/mp_region.c src/mp/mp_mvcc.c src/mp/mp_fget.c src/mutex/mut_method.c src/mutex/mut_tas.c && \ + sed -i.old 's/WinIoCtl\.h/winioctl\.h/g' src/dbinc/win_db.h && \ cp -f $(BASEDIR)/config.guess $(BASEDIR)/config.sub dist endef @@ -23,7 +24,7 @@ define $(package)_config_cmds endef define $(package)_build_cmds - $(MAKE) libdb_cxx-4.8.a libdb-4.8.a + $(MAKE) libdb_cxx-5.1.a libdb-5.1.a endef define $(package)_stage_cmds diff --git a/depends/packages/openssl.mk b/depends/packages/openssl.mk index db47113b2..e258bc222 100644 --- a/depends/packages/openssl.mk +++ b/depends/packages/openssl.mk @@ -1,8 +1,8 @@ package=openssl -$(package)_version=1.0.1k +$(package)_version=1.0.1l $(package)_download_path=https://www.openssl.org/source $(package)_file_name=$(package)-$($(package)_version).tar.gz -$(package)_sha256_hash=8f9faeaebad088e772f4ef5e38252d472be4d878c6b3a2718c10a4fcebe7a41c +$(package)_sha256_hash=b2cf4d48fe5d49f240c61c9e624193a6f232b5ed0baf010681e725963c40d1d4 define $(package)_set_vars $(package)_config_env=AR="$($(package)_ar)" RANLIB="$($(package)_ranlib)" CC="$($(package)_cc)" diff --git a/depends/packages/qt.mk b/depends/packages/qt.mk index 113b8dbc3..7a404e10f 100644 --- a/depends/packages/qt.mk +++ b/depends/packages/qt.mk @@ -7,7 +7,7 @@ $(package)_sha256_hash=eed620cb268b199bd83b3fc6a471c51d51e1dc2dbb5374fc97a0cc75f $(package)_dependencies=openssl zlib $(package)_linux_dependencies=freetype fontconfig libxcb libX11 xproto libXext $(package)_build_subdir=qtbase -$(package)_qt_libs=corelib network widgets gui plugins testlib +$(package)_qt_libs=corelib network widgets gui plugins testlib printsupport $(package)_patches=fix_qt_pkgconfig.patch mac-qmake.conf fix_configure_mac.patch fix_no_printer.patch fix_rcc_determinism.patch xkb-default.patch $(package)_qttranslations_file_name=qttranslations-$($(package)_suffix) From ce564e381aba126dbfc33a26184a4b8e1e3b077c Mon Sep 17 00:00:00 2001 From: Ross Nicoll Date: Tue, 16 Oct 2018 22:38:56 +0000 Subject: [PATCH 3/6] 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/Makefile.am | 6 + src/Makefile.test.include | 1 + src/auxpow.cpp | 198 ++++++ src/auxpow.h | 204 ++++++ src/chain.cpp | 28 + src/chain.h | 31 +- src/chainparams.cpp | 13 +- src/chainparams.h | 1 + src/consensus/params.h | 18 + src/dogecoin.cpp | 52 +- src/dogecoin.h | 10 +- src/init.cpp | 8 + src/miner.cpp | 16 +- src/miner.h | 3 + src/net_processing.cpp | 6 +- src/policy/policy.h | 4 +- src/pow.cpp | 1 + src/primitives/block.cpp | 20 +- src/primitives/block.h | 59 +- src/primitives/pureheader.cpp | 29 + src/primitives/pureheader.h | 155 +++++ src/qt/test/wallettests.cpp | 2 +- src/rest.cpp | 3 +- src/rpc/auxpow_miner.cpp | 165 +++++ src/rpc/auxpow_miner.h | 95 +++ src/rpc/blockchain.cpp | 43 +- src/rpc/mining.cpp | 81 ++- src/rpc/mining.h | 7 + src/test/auxpow_tests.cpp | 589 ++++++++++++++++++ src/test/coins_tests.cpp | 9 - src/test/merkle_tests.cpp | 2 +- src/test/test_bitcoin.cpp | 9 + src/test/test_bitcoin.h | 8 + src/txdb.cpp | 7 +- src/validation.cpp | 56 +- src/validation.h | 2 + src/wallet/rpcwallet.cpp | 72 ++- src/wallet/wallet.h | 49 +- test/functional/auxpow_mining.py | 188 ++++++ test/functional/interface_rest.py | 20 +- test/functional/test_framework/auxpow.py | 104 ++++ .../test_framework/auxpow_testing.py | 82 +++ 42 files changed, 2292 insertions(+), 164 deletions(-) create mode 100644 src/auxpow.cpp create mode 100644 src/auxpow.h create mode 100644 src/primitives/pureheader.cpp create mode 100644 src/primitives/pureheader.h create mode 100644 src/rpc/auxpow_miner.cpp create mode 100644 src/rpc/auxpow_miner.h create mode 100644 src/test/auxpow_tests.cpp create mode 100755 test/functional/auxpow_mining.py create mode 100644 test/functional/test_framework/auxpow.py create mode 100644 test/functional/test_framework/auxpow_testing.py diff --git a/src/Makefile.am b/src/Makefile.am index 0c57e6fc8..1653af522 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -92,6 +92,7 @@ endif BITCOIN_CORE_H = \ addrdb.h \ addrman.h \ + auxpow.h \ base58.h \ bech32.h \ bloom.h \ @@ -151,6 +152,7 @@ BITCOIN_CORE_H = \ random.h \ reverse_iterator.h \ reverselock.h \ + rpc/auxpow_miner.h \ rpc/blockchain.h \ rpc/client.h \ rpc/mining.h \ @@ -241,6 +243,7 @@ libbitcoin_server_a_SOURCES = \ policy/rbf.cpp \ pow.cpp \ rest.cpp \ + rpc/auxpow_miner.cpp \ rpc/blockchain.cpp \ rpc/mining.cpp \ rpc/misc.cpp \ @@ -353,6 +356,8 @@ libbitcoin_consensus_a_SOURCES = \ prevector.h \ primitives/block.cpp \ primitives/block.h \ + primitives/pureheader.cpp \ + primitives/pureheader.h \ primitives/transaction.cpp \ primitives/transaction.h \ pubkey.cpp \ @@ -377,6 +382,7 @@ libbitcoin_consensus_a_SOURCES = \ libbitcoin_common_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) libbitcoin_common_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) libbitcoin_common_a_SOURCES = \ + auxpow.cpp \ base58.cpp \ bech32.cpp \ chainparams.cpp \ diff --git a/src/Makefile.test.include b/src/Makefile.test.include index 6f309f3d6..96fe2d4e6 100644 --- a/src/Makefile.test.include +++ b/src/Makefile.test.include @@ -32,6 +32,7 @@ BITCOIN_TESTS =\ test/addrman_tests.cpp \ test/amount_tests.cpp \ test/allocator_tests.cpp \ + test/auxpow_tests.cpp \ test/base32_tests.cpp \ test/base58_tests.cpp \ test/base64_tests.cpp \ diff --git a/src/auxpow.cpp b/src/auxpow.cpp new file mode 100644 index 000000000..208a54bec --- /dev/null +++ b/src/auxpow.cpp @@ -0,0 +1,198 @@ +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2011 Vince Durham +// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2014-2017 Daniel Kraft +// Distributed under the MIT/X11 software license, see the accompanying +// file license.txt or http://www.opensource.org/licenses/mit-license.php. + +#include + +#include +#include +#include +#include +#include +#include