diff --git a/contrib/devtools/chainparams/generate_chainparams_constants.py b/contrib/devtools/chainparams/generate_chainparams_constants.py --- a/contrib/devtools/chainparams/generate_chainparams_constants.py +++ b/contrib/devtools/chainparams/generate_chainparams_constants.py @@ -49,13 +49,14 @@ * @{} by contrib/devtools/chainparams/generate_chainparams_constants.py */ +#include #include namespace ChainParamsConstants {{ - const uint256 MAINNET_DEFAULT_ASSUME_VALID = uint256S("{}"); + const BlockHash MAINNET_DEFAULT_ASSUME_VALID = BlockHash::fromHex("{}"); const uint256 MAINNET_MINIMUM_CHAIN_WORK = uint256S("{}"); - const uint256 TESTNET_DEFAULT_ASSUME_VALID = uint256S("{}"); + const BlockHash TESTNET_DEFAULT_ASSUME_VALID = BlockHash::fromHex("{}"); const uint256 TESTNET_MINIMUM_CHAIN_WORK = uint256S("{}"); }} // namespace ChainParamsConstants diff --git a/src/avalanche.cpp b/src/avalanche.cpp --- a/src/avalanche.cpp +++ b/src/avalanche.cpp @@ -223,7 +223,7 @@ { LOCK(cs_main); for (auto &v : votes) { - BlockMap::iterator mi = mapBlockIndex.find(v.GetHash()); + BlockMap::iterator mi = mapBlockIndex.find(BlockHash(v.GetHash())); if (mi == mapBlockIndex.end()) { // This should not happen, but just in case... continue; @@ -414,7 +414,7 @@ { LOCK(cs_main); - BlockMap::iterator mi = mapBlockIndex.find(inv.hash); + BlockMap::iterator mi = mapBlockIndex.find(BlockHash(inv.hash)); if (mi == mapBlockIndex.end()) { continue; } diff --git a/src/blockencodings.h b/src/blockencodings.h --- a/src/blockencodings.h +++ b/src/blockencodings.h @@ -32,7 +32,7 @@ class BlockTransactionsRequest { public: // A BlockTransactionsRequest message - uint256 blockhash; + BlockHash blockhash; std::vector indices; ADD_SERIALIZE_METHODS; diff --git a/src/chain.h b/src/chain.h --- a/src/chain.h +++ b/src/chain.h @@ -52,7 +52,7 @@ public: //! pointer to the hash of the block, if any. Memory is owned by this //! CBlockIndex - const uint256 *phashBlock; + const BlockHash *phashBlock; //! pointer to the index of the predecessor of this block CBlockIndex *pprev; @@ -175,7 +175,7 @@ return block; } - uint256 GetBlockHash() const { return *phashBlock; } + BlockHash GetBlockHash() const { return *phashBlock; } int64_t GetBlockTime() const { return int64_t(nTime); } @@ -247,16 +247,16 @@ // this used to call `GetCheapHash()` in uint256, which was later moved; the // cheap hash function simply calls ReadLE64() however, so the end result is // identical - size_t operator()(const uint256 &hash) const { + size_t operator()(const BlockHash &hash) const { return ReadLE64(hash.begin()); } }; -typedef std::unordered_map BlockMap; +typedef std::unordered_map BlockMap; extern BlockMap &mapBlockIndex; extern CCriticalSection cs_main; -inline CBlockIndex *LookupBlockIndex(const uint256 &hash) { +inline CBlockIndex *LookupBlockIndex(const BlockHash &hash) { AssertLockHeld(cs_main); BlockMap::const_iterator it = mapBlockIndex.find(hash); return it == mapBlockIndex.end() ? nullptr : it->second; @@ -287,12 +287,12 @@ /** Used to marshal pointers into hashes for db storage. */ class CDiskBlockIndex : public CBlockIndex { public: - uint256 hashPrev; + BlockHash hashPrev; - CDiskBlockIndex() { hashPrev = uint256(); } + CDiskBlockIndex() { hashPrev = BlockHash(); } explicit CDiskBlockIndex(const CBlockIndex *pindex) : CBlockIndex(*pindex) { - hashPrev = (pprev ? pprev->GetBlockHash() : uint256()); + hashPrev = (pprev ? pprev->GetBlockHash() : BlockHash()); } ADD_SERIALIZE_METHODS; @@ -326,7 +326,7 @@ READWRITE(nNonce); } - uint256 GetBlockHash() const { + BlockHash GetBlockHash() const { CBlockHeader block; block.nVersion = nVersion; block.hashPrevBlock = hashPrev; diff --git a/src/chain.cpp b/src/chain.cpp --- a/src/chain.cpp +++ b/src/chain.cpp @@ -23,7 +23,7 @@ CBlockLocator CChain::GetLocator(const CBlockIndex *pindex) const { int nStep = 1; - std::vector vHave; + std::vector vHave; vHave.reserve(32); if (!pindex) { diff --git a/src/chainparams.h b/src/chainparams.h --- a/src/chainparams.h +++ b/src/chainparams.h @@ -19,7 +19,7 @@ uint16_t port; }; -typedef std::map MapCheckpoints; +typedef std::map MapCheckpoints; struct CCheckpointData { MapCheckpoints mapCheckpoints; diff --git a/src/chainparams.cpp b/src/chainparams.cpp --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -88,7 +88,7 @@ // April 1, 2012 consensus.BIP16Height = 173805; consensus.BIP34Height = 227931; - consensus.BIP34Hash = uint256S( + consensus.BIP34Hash = BlockHash::fromHex( "000000000000024b89b42a942fe0d9fea3bb44ab7bd1b19115dd6a759c0808b8"); // 000000000000000004c2b624ed5d7756c508d90fd0da2c7c679febfa6c4735f0 consensus.BIP65Height = 388381; @@ -188,50 +188,50 @@ checkpointData = { .mapCheckpoints = { - {11111, uint256S("0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee" - "92559f542fdb26e7c1d")}, - {33333, uint256S("000000002dd5588a74784eaa7ab0507a18ad16a236e7b" - "1ce69f00d7ddfb5d0a6")}, - {74000, uint256S("0000000000573993a3c9e41ce34471c079dcf5f52a0e8" - "24a81e7f953b8661a20")}, - {105000, uint256S("00000000000291ce28027faea320c8d2b054b2e0fe44" - "a773f3eefb151d6bdc97")}, - {134444, uint256S("00000000000005b12ffd4cd315cd34ffd4a594f430ac" - "814c91184a0d42d2b0fe")}, - {168000, uint256S("000000000000099e61ea72015e79632f216fe6cb33d7" - "899acb35b75c8303b763")}, - {193000, uint256S("000000000000059f452a5f7340de6682a977387c1701" - "0ff6e6c3bd83ca8b1317")}, - {210000, uint256S("000000000000048b95347e83192f69cf0366076336c6" - "39f9b7228e9ba171342e")}, - {216116, uint256S("00000000000001b4f4b433e81ee46494af945cf96014" - "816a4e2370f11b23df4e")}, - {225430, uint256S("00000000000001c108384350f74090433e7fcf79a606" - "b8e797f065b130575932")}, - {250000, uint256S("000000000000003887df1f29024b06fc2200b55f8af8" - "f35453d7be294df2d214")}, - {279000, uint256S("0000000000000001ae8c72a0b0c301f67e3afca10e81" - "9efa9041e458e9bd7e40")}, - {295000, uint256S("00000000000000004d9b4ef50f0f9d686fd69db2e03a" - "f35a100370c64632a983")}, + {11111, BlockHash::fromHex("0000000069e244f73d78e8fd29ba2fd2ed6" + "18bd6fa2ee92559f542fdb26e7c1d")}, + {33333, BlockHash::fromHex("000000002dd5588a74784eaa7ab0507a18a" + "d16a236e7b1ce69f00d7ddfb5d0a6")}, + {74000, BlockHash::fromHex("0000000000573993a3c9e41ce34471c079d" + "cf5f52a0e824a81e7f953b8661a20")}, + {105000, BlockHash::fromHex("00000000000291ce28027faea320c8d2b0" + "54b2e0fe44a773f3eefb151d6bdc97")}, + {134444, BlockHash::fromHex("00000000000005b12ffd4cd315cd34ffd4" + "a594f430ac814c91184a0d42d2b0fe")}, + {168000, BlockHash::fromHex("000000000000099e61ea72015e79632f21" + "6fe6cb33d7899acb35b75c8303b763")}, + {193000, BlockHash::fromHex("000000000000059f452a5f7340de6682a9" + "77387c17010ff6e6c3bd83ca8b1317")}, + {210000, BlockHash::fromHex("000000000000048b95347e83192f69cf03" + "66076336c639f9b7228e9ba171342e")}, + {216116, BlockHash::fromHex("00000000000001b4f4b433e81ee46494af" + "945cf96014816a4e2370f11b23df4e")}, + {225430, BlockHash::fromHex("00000000000001c108384350f74090433e" + "7fcf79a606b8e797f065b130575932")}, + {250000, BlockHash::fromHex("000000000000003887df1f29024b06fc22" + "00b55f8af8f35453d7be294df2d214")}, + {279000, BlockHash::fromHex("0000000000000001ae8c72a0b0c301f67e" + "3afca10e819efa9041e458e9bd7e40")}, + {295000, BlockHash::fromHex("00000000000000004d9b4ef50f0f9d686f" + "d69db2e03af35a100370c64632a983")}, // UAHF fork block. - {478558, uint256S("0000000000000000011865af4122fe3b144e2cbeea86" - "142e8ff2fb4107352d43")}, + {478558, BlockHash::fromHex("0000000000000000011865af4122fe3b14" + "4e2cbeea86142e8ff2fb4107352d43")}, // Nov, 13 DAA activation block. - {504031, uint256S("0000000000000000011ebf65b60d0a3de80b8175be70" - "9d653b4c1a1beeb6ab9c")}, + {504031, BlockHash::fromHex("0000000000000000011ebf65b60d0a3de8" + "0b8175be709d653b4c1a1beeb6ab9c")}, // Monolith activation. - {530359, uint256S("0000000000000000011ada8bd08f46074f44a8f15539" - "6f43e38acf9501c49103")}, + {530359, BlockHash::fromHex("0000000000000000011ada8bd08f46074f" + "44a8f155396f43e38acf9501c49103")}, // Magnetic anomaly activation. - {556767, uint256S("0000000000000000004626ff6e3b936941d341c5932e" - "ce4357eeccac44e6d56c")}, + {556767, BlockHash::fromHex("0000000000000000004626ff6e3b936941" + "d341c5932ece4357eeccac44e6d56c")}, // Great wall activation. - {582680, uint256S("000000000000000001b4b8e36aec7d4f9671a47872cb" - "9a74dc16ca398c7dcc18")}, + {582680, BlockHash::fromHex("000000000000000001b4b8e36aec7d4f96" + "71a47872cb9a74dc16ca398c7dcc18")}, // Graviton activation. - {609136, uint256S("000000000000000000b48bb207faac5ac655c313e41a" - "c909322eaa694f5bc5b1")}, + {609136, BlockHash::fromHex("000000000000000000b48bb207faac5ac6" + "55c313e41ac909322eaa694f5bc5b1")}, }}; // Data as of block @@ -259,7 +259,7 @@ // 00000000040b4e986385315e14bee30ad876d8b47f748025b26683116d21aa65 consensus.BIP16Height = 514; consensus.BIP34Height = 21111; - consensus.BIP34Hash = uint256S( + consensus.BIP34Hash = BlockHash::fromHex( "0000000023b3a96d3484e5abb3755c413e7d41500f8e2a5c3f0dd01299cd8ef8"); // 00000000007f6655f22f98e72ed80d8b06dc761d5da09df0fa1dc4be4f861eb6 consensus.BIP65Height = 581885; @@ -349,20 +349,24 @@ checkpointData = { .mapCheckpoints = { - {546, uint256S("000000002a936ca763904c3c35fce2f3556c559c0214345" - "d31b1bcebf76acb70")}, + {546, BlockHash::fromHex("000000002a936ca763904c3c35fce2f3556c5" + "59c0214345d31b1bcebf76acb70")}, // UAHF fork block. - {1155875, uint256S("00000000f17c850672894b9a75b63a1e72830bbd5f4" - "c8889b5c1a80e7faef138")}, + {1155875, + BlockHash::fromHex("00000000f17c850672894b9a75b63a1e72830bbd5f" + "4c8889b5c1a80e7faef138")}, // Nov, 13. DAA activation block. - {1188697, uint256S("0000000000170ed0918077bde7b4d36cc4c91be69fa" - "09211f748240dabe047fb")}, + {1188697, + BlockHash::fromHex("0000000000170ed0918077bde7b4d36cc4c91be69f" + "a09211f748240dabe047fb")}, // Great wall activation. - {1303885, uint256S("00000000000000479138892ef0e4fa478ccc938fb94" - "df862ef5bde7e8dee23d3")}, + {1303885, + BlockHash::fromHex("00000000000000479138892ef0e4fa478ccc938fb9" + "4df862ef5bde7e8dee23d3")}, // Graviton activation. - {1341712, uint256S("00000000fffc44ea2e202bd905a9fbbb9491ef9e9d5" - "a9eed4039079229afa35b")}, + {1341712, + BlockHash::fromHex("00000000fffc44ea2e202bd905a9fbbb9491ef9e9d" + "5a9eed4039079229afa35b")}, }}; // Data as of block @@ -385,7 +389,7 @@ // BIP34 has not activated on regtest (far in the future so block v1 are // not rejected in tests) consensus.BIP34Height = 100000000; - consensus.BIP34Hash = uint256(); + consensus.BIP34Hash = BlockHash(); // BIP65 activated on regtest (Used in rpc activation tests) consensus.BIP65Height = 1351; // BIP66 activated on regtest (Used in rpc activation tests) @@ -405,7 +409,7 @@ // By default assume that the signatures in ancestors of this block are // valid. - consensus.defaultAssumeValid = uint256S("0x00"); + consensus.defaultAssumeValid = BlockHash(); // UAHF is always enabled on regtest. consensus.uahfHeight = 0; @@ -451,10 +455,11 @@ fRequireStandard = false; fMineBlocksOnDemand = true; - checkpointData = {.mapCheckpoints = { - {0, uint256S("0f9188f13cb7b2c71f2a335e3a4fc328bf5" - "beb436012afca590b1a11466e2206")}, - }}; + checkpointData = { + .mapCheckpoints = { + {0, BlockHash::fromHex("0f9188f13cb7b2c71f2a335e3a4fc328bf5beb4" + "36012afca590b1a11466e2206")}, + }}; chainTxData = ChainTxData{0, 0, 0}; diff --git a/src/chainparamsconstants.h b/src/chainparamsconstants.h --- a/src/chainparamsconstants.h +++ b/src/chainparamsconstants.h @@ -5,13 +5,14 @@ * @generated by contrib/devtools/chainparams/generate_chainparams_constants.py */ +#include #include namespace ChainParamsConstants { - const uint256 MAINNET_DEFAULT_ASSUME_VALID = uint256S("00000000000000000307337585f9000103c1af9f6a2655fb26ccad992480dfd1"); + const BlockHash MAINNET_DEFAULT_ASSUME_VALID = BlockHash::fromHex("00000000000000000307337585f9000103c1af9f6a2655fb26ccad992480dfd1"); const uint256 MAINNET_MINIMUM_CHAIN_WORK = uint256S("0000000000000000000000000000000000000000010a3e29d11e8ea2ac87538f"); - const uint256 TESTNET_DEFAULT_ASSUME_VALID = uint256S("0000000000fdd666224731fc707eee787ad3f3281fd381801ef26d4fcea133f1"); + const BlockHash TESTNET_DEFAULT_ASSUME_VALID = BlockHash::fromHex("0000000000fdd666224731fc707eee787ad3f3281fd381801ef26d4fcea133f1"); const uint256 TESTNET_MINIMUM_CHAIN_WORK = uint256S("000000000000000000000000000000000000000000000052a25c79a348846d12"); } // namespace ChainParamsConstants diff --git a/src/checkpoints.h b/src/checkpoints.h --- a/src/checkpoints.h +++ b/src/checkpoints.h @@ -5,11 +5,8 @@ #ifndef BITCOIN_CHECKPOINTS_H #define BITCOIN_CHECKPOINTS_H -#include - -#include - class CBlockIndex; +struct BlockHash; struct CCheckpointData; /** @@ -19,7 +16,8 @@ namespace Checkpoints { //! Returns true if block passes checkpoint checks -bool CheckBlock(const CCheckpointData &data, int nHeight, const uint256 &hash); +bool CheckBlock(const CCheckpointData &data, int nHeight, + const BlockHash &hash); //! Returns last CBlockIndex* that is a checkpoint CBlockIndex *GetLastCheckpoint(const CCheckpointData &data); diff --git a/src/checkpoints.cpp b/src/checkpoints.cpp --- a/src/checkpoints.cpp +++ b/src/checkpoints.cpp @@ -12,7 +12,8 @@ namespace Checkpoints { -bool CheckBlock(const CCheckpointData &data, int nHeight, const uint256 &hash) { +bool CheckBlock(const CCheckpointData &data, int nHeight, + const BlockHash &hash) { const MapCheckpoints &checkpoints = data.mapCheckpoints; MapCheckpoints::const_iterator i = checkpoints.find(nHeight); @@ -26,7 +27,7 @@ const MapCheckpoints &checkpoints = data.mapCheckpoints; for (const MapCheckpoints::value_type &i : reverse_iterate(checkpoints)) { - const uint256 &hash = i.second; + const BlockHash &hash = i.second; CBlockIndex *pindex = LookupBlockIndex(hash); if (pindex) { return pindex; diff --git a/src/coins.h b/src/coins.h --- a/src/coins.h +++ b/src/coins.h @@ -118,7 +118,7 @@ /** Cursor for iterating over CoinsView state */ class CCoinsViewCursor { public: - CCoinsViewCursor(const uint256 &hashBlockIn) : hashBlock(hashBlockIn) {} + CCoinsViewCursor(const BlockHash &hashBlockIn) : hashBlock(hashBlockIn) {} virtual ~CCoinsViewCursor() {} virtual bool GetKey(COutPoint &key) const = 0; @@ -129,10 +129,10 @@ virtual void Next() = 0; //! Get best block at the time this cursor was created - const uint256 &GetBestBlock() const { return hashBlock; } + const BlockHash &GetBestBlock() const { return hashBlock; } private: - uint256 hashBlock; + BlockHash hashBlock; }; /** Abstract view on the open txout dataset. */ @@ -149,18 +149,18 @@ virtual bool HaveCoin(const COutPoint &outpoint) const; //! Retrieve the block hash whose state this CCoinsView currently represents - virtual uint256 GetBestBlock() const; + virtual BlockHash GetBestBlock() const; //! Retrieve the range of blocks that may have been only partially written. //! If the database is in a consistent state, the result is the empty //! vector. //! Otherwise, a two-element vector is returned consisting of the new and //! the old block hash, in that order. - virtual std::vector GetHeadBlocks() const; + virtual std::vector GetHeadBlocks() const; //! Do a bulk modification (multiple Coin changes + BestBlock change). //! The passed mapCoins can be modified. - virtual bool BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock); + virtual bool BatchWrite(CCoinsMap &mapCoins, const BlockHash &hashBlock); //! Get a cursor to iterate over the whole state virtual CCoinsViewCursor *Cursor() const; @@ -181,10 +181,10 @@ CCoinsViewBacked(CCoinsView *viewIn); bool GetCoin(const COutPoint &outpoint, Coin &coin) const override; bool HaveCoin(const COutPoint &outpoint) const override; - uint256 GetBestBlock() const override; - std::vector GetHeadBlocks() const override; + BlockHash GetBestBlock() const override; + std::vector GetHeadBlocks() const override; void SetBackend(CCoinsView &viewIn); - bool BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock) override; + bool BatchWrite(CCoinsMap &mapCoins, const BlockHash &hashBlock) override; CCoinsViewCursor *Cursor() const override; size_t EstimateSize() const override; }; @@ -198,7 +198,7 @@ * Make mutable so that we can "fill the cache" even from Get-methods * declared as "const". */ - mutable uint256 hashBlock; + mutable BlockHash hashBlock; mutable CCoinsMap cacheCoins; /* Cached dynamic memory usage for the inner Coin objects. */ @@ -216,9 +216,9 @@ // Standard CCoinsView methods bool GetCoin(const COutPoint &outpoint, Coin &coin) const override; bool HaveCoin(const COutPoint &outpoint) const override; - uint256 GetBestBlock() const override; - void SetBestBlock(const uint256 &hashBlock); - bool BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock) override; + BlockHash GetBestBlock() const override; + void SetBestBlock(const BlockHash &hashBlock); + bool BatchWrite(CCoinsMap &mapCoins, const BlockHash &hashBlock) override; CCoinsViewCursor *Cursor() const override { throw std::logic_error( "CCoinsViewCache cursor iteration not supported."); diff --git a/src/coins.cpp b/src/coins.cpp --- a/src/coins.cpp +++ b/src/coins.cpp @@ -14,13 +14,13 @@ bool CCoinsView::GetCoin(const COutPoint &outpoint, Coin &coin) const { return false; } -uint256 CCoinsView::GetBestBlock() const { - return uint256(); +BlockHash CCoinsView::GetBestBlock() const { + return BlockHash(); } -std::vector CCoinsView::GetHeadBlocks() const { - return std::vector(); +std::vector CCoinsView::GetHeadBlocks() const { + return std::vector(); } -bool CCoinsView::BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock) { +bool CCoinsView::BatchWrite(CCoinsMap &mapCoins, const BlockHash &hashBlock) { return false; } CCoinsViewCursor *CCoinsView::Cursor() const { @@ -38,17 +38,17 @@ bool CCoinsViewBacked::HaveCoin(const COutPoint &outpoint) const { return base->HaveCoin(outpoint); } -uint256 CCoinsViewBacked::GetBestBlock() const { +BlockHash CCoinsViewBacked::GetBestBlock() const { return base->GetBestBlock(); } -std::vector CCoinsViewBacked::GetHeadBlocks() const { +std::vector CCoinsViewBacked::GetHeadBlocks() const { return base->GetHeadBlocks(); } void CCoinsViewBacked::SetBackend(CCoinsView &viewIn) { base = &viewIn; } bool CCoinsViewBacked::BatchWrite(CCoinsMap &mapCoins, - const uint256 &hashBlock) { + const BlockHash &hashBlock) { return base->BatchWrite(mapCoins, hashBlock); } CCoinsViewCursor *CCoinsViewBacked::Cursor() const { @@ -183,19 +183,19 @@ return (it != cacheCoins.end() && !it->second.coin.IsSpent()); } -uint256 CCoinsViewCache::GetBestBlock() const { +BlockHash CCoinsViewCache::GetBestBlock() const { if (hashBlock.IsNull()) { hashBlock = base->GetBestBlock(); } return hashBlock; } -void CCoinsViewCache::SetBestBlock(const uint256 &hashBlockIn) { +void CCoinsViewCache::SetBestBlock(const BlockHash &hashBlockIn) { hashBlock = hashBlockIn; } bool CCoinsViewCache::BatchWrite(CCoinsMap &mapCoins, - const uint256 &hashBlockIn) { + const BlockHash &hashBlockIn) { for (CCoinsMap::iterator it = mapCoins.begin(); it != mapCoins.end(); it = mapCoins.erase(it)) { // Ignore non-dirty entries (optimization). diff --git a/src/consensus/params.h b/src/consensus/params.h --- a/src/consensus/params.h +++ b/src/consensus/params.h @@ -6,24 +6,22 @@ #ifndef BITCOIN_CONSENSUS_PARAMS_H #define BITCOIN_CONSENSUS_PARAMS_H +#include #include -#include -#include - namespace Consensus { /** * Parameters that influence chain consensus. */ struct Params { - uint256 hashGenesisBlock; + BlockHash hashGenesisBlock; int nSubsidyHalvingInterval; /** Block height at which BIP16 becomes active */ int BIP16Height; /** Block height and hash at which BIP34 becomes active */ int BIP34Height; - uint256 BIP34Hash; + BlockHash BIP34Hash; /** Block height at which BIP65 becomes active */ int BIP65Height; /** Block height at which BIP66 becomes active */ @@ -50,7 +48,7 @@ return nPowTargetTimespan / nPowTargetSpacing; } uint256 nMinimumChainWork; - uint256 defaultAssumeValid; + BlockHash defaultAssumeValid; }; } // namespace Consensus diff --git a/src/index/base.cpp b/src/index/base.cpp --- a/src/index/base.cpp +++ b/src/index/base.cpp @@ -196,7 +196,7 @@ return; } - const uint256 &locator_tip_hash = locator.vHave.front(); + const BlockHash &locator_tip_hash = locator.vHave.front(); const CBlockIndex *locator_tip_index; { LOCK(cs_main); diff --git a/src/init.cpp b/src/init.cpp --- a/src/init.cpp +++ b/src/init.cpp @@ -1594,7 +1594,7 @@ LogPrintf("Skipping checkpoint verification.\n"); } - hashAssumeValid = uint256S( + hashAssumeValid = BlockHash::fromHex( gArgs.GetArg("-assumevalid", chainparams.GetConsensus().defaultAssumeValid.GetHex())); if (!hashAssumeValid.IsNull()) { diff --git a/src/net.h b/src/net.h --- a/src/net.h +++ b/src/net.h @@ -680,7 +680,7 @@ mapMsgCmdSize mapRecvBytesPerMsgCmd GUARDED_BY(cs_vRecv); public: - uint256 hashContinue; + BlockHash hashContinue; std::atomic nStartingHeight{-1}; // flood relay @@ -703,7 +703,7 @@ CCriticalSection cs_inventory; int64_t nNextInvSend{0}; // Used for headers announcements - unfiltered blocks to relay. - std::vector vBlockHashesToAnnounce GUARDED_BY(cs_inventory); + std::vector vBlockHashesToAnnounce GUARDED_BY(cs_inventory); // Used for BIP35 mempool sending. bool fSendMempool GUARDED_BY(cs_inventory){false}; @@ -821,7 +821,7 @@ } } - void PushBlockHash(const uint256 &hash) { + void PushBlockHash(const BlockHash &hash) { LOCK(cs_inventory); vBlockHashesToAnnounce.push_back(hash); } diff --git a/src/net.cpp b/src/net.cpp --- a/src/net.cpp +++ b/src/net.cpp @@ -2663,7 +2663,7 @@ hSocket = hSocketIn; addrName = addrNameIn == "" ? addr.ToStringIPPort() : addrNameIn; strSubVer = ""; - hashContinue = uint256(); + hashContinue = BlockHash(); filterInventoryKnown.reset(); pfilter = std::make_unique(); diff --git a/src/net_processing.cpp b/src/net_processing.cpp --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -252,7 +252,7 @@ //! The best known block we know this peer has announced. const CBlockIndex *pindexBestKnownBlock; //! The hash of the last unknown block this peer has announced. - uint256 hashLastUnknownBlock; + BlockHash hashLastUnknownBlock; //! The last full block we both have. const CBlockIndex *pindexLastCommonBlock; //! The best header we have sent our peer. @@ -396,7 +396,7 @@ nMisbehavior = 0; fShouldBan = false; pindexBestKnownBlock = nullptr; - hashLastUnknownBlock.SetNull(); + hashLastUnknownBlock = BlockHash(); pindexLastCommonBlock = nullptr; pindexBestHeaderSent = nullptr; nUnconnectingHeaders = 0; @@ -587,7 +587,7 @@ } /** Update tracking information about which blocks a peer is assumed to have. */ -static void UpdateBlockAvailability(NodeId nodeid, const uint256 &hash) +static void UpdateBlockAvailability(NodeId nodeid, const BlockHash &hash) EXCLUSIVE_LOCKS_REQUIRED(cs_main) { CNodeState *state = State(nodeid); assert(state != nullptr); @@ -1302,7 +1302,7 @@ if (!fInitialDownload) { // Find the hashes of all blocks that weren't previously in the best // chain. - std::vector vHashes; + std::vector vHashes; const CBlockIndex *pindexToAnnounce = pindexNew; while (pindexToAnnounce != pindexFork) { vHashes.push_back(pindexToAnnounce->GetBlockHash()); @@ -1319,7 +1319,7 @@ if (nNewHeight > (pnode->nStartingHeight != -1 ? pnode->nStartingHeight - 2000 : 0)) { - for (const uint256 &hash : reverse_iterate(vHashes)) { + for (const BlockHash &hash : reverse_iterate(vHashes)) { pnode->PushBlockHash(hash); } } @@ -1414,7 +1414,7 @@ pcoinsTip->HaveCoinInCache(COutPoint(txid, 1)); } case MSG_BLOCK: - return LookupBlockIndex(inv.hash) != nullptr; + return LookupBlockIndex(BlockHash(inv.hash)) != nullptr; } // Don't know what it is, just say we already got one return true; @@ -1474,6 +1474,8 @@ const Consensus::Params &consensusParams = config.GetChainParams().GetConsensus(); + const BlockHash hash(inv.hash); + bool send = false; std::shared_ptr a_recent_block; std::shared_ptr a_recent_compact_block; @@ -1486,7 +1488,7 @@ bool need_activate_chain = false; { LOCK(cs_main); - const CBlockIndex *pindex = LookupBlockIndex(inv.hash); + const CBlockIndex *pindex = LookupBlockIndex(hash); if (pindex) { if (pindex->nChainTx && !pindex->IsValid(BlockValidity::SCRIPTS) && pindex->IsValid(BlockValidity::TREE)) { @@ -1508,7 +1510,7 @@ } LOCK(cs_main); - const CBlockIndex *pindex = LookupBlockIndex(inv.hash); + const CBlockIndex *pindex = LookupBlockIndex(hash); if (pindex) { send = BlockRequestAllowed(pindex, consensusParams); if (!send) { @@ -1626,14 +1628,14 @@ // Trigger the peer node to send a getblocks request for the next batch // of inventory. - if (inv.hash == pfrom->hashContinue) { + if (hash == pfrom->hashContinue) { // Bypass PushInventory, this must send even if redundant, and we // want it right after the last block so they don't wait for other // stuff first. std::vector vInv; vInv.push_back(CInv(MSG_BLOCK, chainActive.Tip()->GetBlockHash())); connman->PushMessage(pfrom, msgMaker.Make(NetMsgType::INV, vInv)); - pfrom->hashContinue.SetNull(); + pfrom->hashContinue = BlockHash(); } } } @@ -1794,7 +1796,7 @@ return true; } - uint256 hashLastBlock; + BlockHash hashLastBlock; for (const CBlockHeader &header : headers) { if (!hashLastBlock.IsNull() && header.hashPrevBlock != hashLastBlock) { @@ -2444,9 +2446,10 @@ fAlreadyHave ? "have" : "new", pfrom->GetId()); if (inv.type == MSG_BLOCK) { - UpdateBlockAvailability(pfrom->GetId(), inv.hash); + const BlockHash hash(inv.hash); + UpdateBlockAvailability(pfrom->GetId(), hash); if (!fAlreadyHave && !fImporting && !fReindex && - !mapBlocksInFlight.count(inv.hash)) { + !mapBlocksInFlight.count(hash)) { // We used to request the full block here, but since // headers-announcements are now the primary method of // announcement on the network, and since, in the case that @@ -2458,9 +2461,9 @@ pfrom, msgMaker.Make(NetMsgType::GETHEADERS, chainActive.GetLocator(pindexBestHeader), - inv.hash)); + hash)); LogPrint(BCLog::NET, "getheaders (%d) %s to peer=%d\n", - pindexBestHeader->nHeight, inv.hash.ToString(), + pindexBestHeader->nHeight, hash.ToString(), pfrom->GetId()); } } else { @@ -2642,7 +2645,7 @@ if (strCommand == NetMsgType::GETHEADERS) { CBlockLocator locator; - uint256 hashStop; + BlockHash hashStop; vRecv >> locator >> hashStop; if (locator.vHave.size() > MAX_LOCATOR_SZ) { @@ -4196,7 +4199,7 @@ // Try to find first header that our peer doesn't have, and then // send all headers past that one. If we come across an headers that // aren't on chainActive, give up. - for (const uint256 &hash : pto->vBlockHashesToAnnounce) { + for (const BlockHash &hash : pto->vBlockHashesToAnnounce) { const CBlockIndex *pindex = LookupBlockIndex(hash); assert(pindex); if (chainActive[pindex->nHeight] != pindex) { @@ -4299,7 +4302,7 @@ // last entry in vBlockHashesToAnnounce was our tip at some point in // the past. if (!pto->vBlockHashesToAnnounce.empty()) { - const uint256 &hashToAnnounce = + const BlockHash &hashToAnnounce = pto->vBlockHashesToAnnounce.back(); const CBlockIndex *pindex = LookupBlockIndex(hashToAnnounce); assert(pindex); diff --git a/src/primitives/block.h b/src/primitives/block.h --- a/src/primitives/block.h +++ b/src/primitives/block.h @@ -6,6 +6,7 @@ #ifndef BITCOIN_PRIMITIVES_BLOCK_H #define BITCOIN_PRIMITIVES_BLOCK_H +#include #include #include #include @@ -22,7 +23,7 @@ public: // header int32_t nVersion; - uint256 hashPrevBlock; + BlockHash hashPrevBlock; uint256 hashMerkleRoot; uint32_t nTime; uint32_t nBits; @@ -44,7 +45,7 @@ void SetNull() { nVersion = 0; - hashPrevBlock.SetNull(); + hashPrevBlock = BlockHash(); hashMerkleRoot.SetNull(); nTime = 0; nBits = 0; @@ -53,7 +54,7 @@ bool IsNull() const { return (nBits == 0); } - uint256 GetHash() const; + BlockHash GetHash() const; int64_t GetBlockTime() const { return (int64_t)nTime; } }; @@ -107,11 +108,11 @@ * further back it is, the further before the fork it may be. */ struct CBlockLocator { - std::vector vHave; + std::vector vHave; CBlockLocator() {} - explicit CBlockLocator(const std::vector &vHaveIn) + explicit CBlockLocator(const std::vector &vHaveIn) : vHave(vHaveIn) {} ADD_SERIALIZE_METHODS; diff --git a/src/primitives/block.cpp b/src/primitives/block.cpp --- a/src/primitives/block.cpp +++ b/src/primitives/block.cpp @@ -10,8 +10,8 @@ #include #include -uint256 CBlockHeader::GetHash() const { - return SerializeHash(*this); +BlockHash CBlockHeader::GetHash() const { + return BlockHash(SerializeHash(*this)); } std::string CBlock::ToString() const { diff --git a/src/primitives/blockhash.h b/src/primitives/blockhash.h new file mode 100644 --- /dev/null +++ b/src/primitives/blockhash.h @@ -0,0 +1,24 @@ +// Copyright (c) 2019 The Bitcoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#ifndef BITCOIN_PRIMITIVES_BLOCKHASH_H +#define BITCOIN_PRIMITIVES_BLOCKHASH_H + +#include + +/** + * A BlockHash is a unqiue identifier for a block. + */ +struct BlockHash : public uint256 { + explicit BlockHash() : uint256() {} + explicit BlockHash(const uint256 &b) : uint256(b) {} + + static BlockHash fromHex(const std::string &str) { + BlockHash r; + r.SetHex(str); + return r; + } +}; + +#endif // BITCOIN_PRIMITIVES_BLOCKHASH_H diff --git a/src/rest.cpp b/src/rest.cpp --- a/src/rest.cpp +++ b/src/rest.cpp @@ -153,11 +153,13 @@ } std::string hashStr = path[1]; - uint256 hash; - if (!ParseHashStr(hashStr, hash)) { + uint256 rawHash; + if (!ParseHashStr(hashStr, rawHash)) { return RESTERR(req, HTTP_BAD_REQUEST, "Invalid hash: " + hashStr); } + const BlockHash hash(rawHash); + const CBlockIndex *tip = nullptr; std::vector headers; headers.reserve(count); @@ -220,11 +222,13 @@ std::string hashStr; const RetFormat rf = ParseDataFormat(hashStr, strURIPart); - uint256 hash; - if (!ParseHashStr(hashStr, hash)) { + uint256 rawHash; + if (!ParseHashStr(hashStr, rawHash)) { return RESTERR(req, HTTP_BAD_REQUEST, "Invalid hash: " + hashStr); } + const BlockHash hash(rawHash); + CBlock block; CBlockIndex *pblockindex = nullptr; CBlockIndex *tip = nullptr; diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -823,7 +823,7 @@ LOCK(cs_main); std::string strHash = request.params[0].get_str(); - uint256 hash(uint256S(strHash)); + BlockHash hash(uint256S(strHash)); bool fVerbose = true; if (!request.params[1].isNull()) { @@ -934,7 +934,7 @@ LOCK(cs_main); std::string strHash = request.params[0].get_str(); - uint256 hash(uint256S(strHash)); + BlockHash hash(uint256S(strHash)); int verbosity = 1; if (!request.params[1].isNull()) { @@ -965,7 +965,7 @@ struct CCoinsStats { int nHeight; - uint256 hashBlock; + BlockHash hashBlock; uint64_t nTransactions; uint64_t nTransactionOutputs; uint64_t nBogoSize; @@ -1425,7 +1425,8 @@ std::set setOrphans; std::set setPrevs; - for (const std::pair &item : mapBlockIndex) { + for (const std::pair &item : + mapBlockIndex) { if (!chainActive.Contains(item.second)) { setOrphans.insert(item.second); setPrevs.insert(item.second->pprev); @@ -1557,7 +1558,7 @@ } std::string strHash = request.params[0].get_str(); - uint256 hash(uint256S(strHash)); + BlockHash hash(uint256S(strHash)); CBlockIndex *pblockindex; { @@ -1594,7 +1595,7 @@ } std::string strHash = request.params[0].get_str(); - uint256 hash(uint256S(strHash)); + BlockHash hash(uint256S(strHash)); CValidationState state; { @@ -1635,7 +1636,7 @@ } const std::string strHash = request.params[0].get_str(); - const uint256 hash(uint256S(strHash)); + const BlockHash hash(uint256S(strHash)); CValidationState state; { @@ -1673,7 +1674,7 @@ } const std::string strHash = request.params[0].get_str(); - const uint256 hash(uint256S(strHash)); + const BlockHash hash(uint256S(strHash)); CValidationState state; { @@ -1715,7 +1716,7 @@ } const std::string strHash = request.params[0].get_str(); - const uint256 hash(uint256S(strHash)); + const BlockHash hash(uint256S(strHash)); { LOCK(cs_main); @@ -1754,7 +1755,7 @@ } const std::string strHash = request.params[0].get_str(); - const uint256 hash(uint256S(strHash)); + const BlockHash hash(uint256S(strHash)); { LOCK(cs_main); @@ -1823,7 +1824,7 @@ LOCK(cs_main); pindex = chainActive.Tip(); } else { - uint256 hash = uint256S(request.params[1].get_str()); + BlockHash hash(uint256S(request.params[1].get_str())); LOCK(cs_main); pindex = LookupBlockIndex(hash); if (!pindex) { @@ -1999,7 +2000,7 @@ pindex = chainActive[height]; } else { const std::string strHash = request.params[0].get_str(); - const uint256 hash(uint256S(strHash)); + const BlockHash hash(uint256S(strHash)); pindex = LookupBlockIndex(hash); if (!pindex) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -473,7 +473,7 @@ "Block decode failed"); } - uint256 hash = block.GetHash(); + const BlockHash hash = block.GetHash(); const CBlockIndex *pindex = LookupBlockIndex(hash); if (pindex) { if (pindex->IsValid(BlockValidity::SCRIPTS)) { @@ -721,7 +721,7 @@ "Block does not start with a coinbase"); } - uint256 hash = block.GetHash(); + const BlockHash hash = block.GetHash(); { LOCK(cs_main); const CBlockIndex *pindex = LookupBlockIndex(hash); diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -36,7 +36,7 @@ #include -static void TxToJSON(const CTransaction &tx, const uint256 hashBlock, +static void TxToJSON(const CTransaction &tx, const BlockHash &hashBlock, UniValue &entry) { // Call into TxToUniv() in bitcoin-common to decode the transaction hex. // @@ -188,7 +188,7 @@ if (!request.params[2].isNull()) { LOCK(cs_main); - uint256 blockhash = ParseHashV(request.params[2], "parameter 3"); + BlockHash blockhash(ParseHashV(request.params[2], "parameter 3")); blockindex = LookupBlockIndex(blockhash); if (!blockindex) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, @@ -203,7 +203,7 @@ } CTransactionRef tx; - uint256 hash_block; + BlockHash hash_block; if (!GetTransaction(params.GetConsensus(), txid, tx, hash_block, true, blockindex)) { std::string errmsg; @@ -291,10 +291,10 @@ CBlockIndex *pblockindex = nullptr; - uint256 hashBlock; + BlockHash hashBlock; if (!request.params[1].isNull()) { LOCK(cs_main); - hashBlock = uint256S(request.params[1].get_str()); + hashBlock = BlockHash::fromHex(request.params[1].get_str()); pblockindex = LookupBlockIndex(hashBlock); if (!pblockindex) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); diff --git a/src/test/avalanche_tests.cpp b/src/test/avalanche_tests.cpp --- a/src/test/avalanche_tests.cpp +++ b/src/test/avalanche_tests.cpp @@ -220,7 +220,7 @@ std::vector updates; CBlock block = CreateAndProcessBlock({}, CScript()); - const uint256 blockHash = block.GetHash(); + const BlockHash blockHash = block.GetHash(); const CBlockIndex *pindex = mapBlockIndex[blockHash]; // Create nodes that supports avalanche. @@ -391,11 +391,11 @@ // Make sure the block has a hash. CBlock blockA = CreateAndProcessBlock({}, CScript()); - const uint256 blockHashA = blockA.GetHash(); + const BlockHash blockHashA = blockA.GetHash(); const CBlockIndex *pindexA = mapBlockIndex[blockHashA]; CBlock blockB = CreateAndProcessBlock({}, CScript()); - const uint256 blockHashB = blockB.GetHash(); + const BlockHash blockHashB = blockB.GetHash(); const CBlockIndex *pindexB = mapBlockIndex[blockHashB]; // Querying for random block returns false. @@ -497,7 +497,7 @@ std::vector updates; CBlock block = CreateAndProcessBlock({}, CScript()); - const uint256 blockHash = block.GetHash(); + const BlockHash blockHash = block.GetHash(); const CBlockIndex *pindex = mapBlockIndex[blockHash]; // There is no node to query. @@ -594,7 +594,7 @@ // Out of order response are rejected. CBlock block2 = CreateAndProcessBlock({}, CScript()); - const uint256 blockHash2 = block2.GetHash(); + const BlockHash blockHash2 = block2.GetHash(); CBlockIndex *pindex2 = mapBlockIndex[blockHash2]; BOOST_CHECK(p.addBlockToReconcile(pindex2)); @@ -644,7 +644,7 @@ std::vector updates; CBlock block = CreateAndProcessBlock({}, CScript()); - const uint256 blockHash = block.GetHash(); + const BlockHash blockHash = block.GetHash(); const CBlockIndex *pindex = mapBlockIndex[blockHash]; // Add the block @@ -714,7 +714,7 @@ // Add a block to poll CBlock block = CreateAndProcessBlock({}, CScript()); - const uint256 blockHash = block.GetHash(); + const BlockHash blockHash = block.GetHash(); const CBlockIndex *pindex = mapBlockIndex[blockHash]; BOOST_CHECK(p.addBlockToReconcile(pindex)); @@ -766,7 +766,7 @@ std::vector updates; CBlock block = CreateAndProcessBlock({}, CScript()); - const uint256 blockHash = block.GetHash(); + const BlockHash blockHash = block.GetHash(); const CBlockIndex *pindex = mapBlockIndex[blockHash]; // Create nodes that supports avalanche. @@ -838,7 +838,7 @@ CScheduler s; CBlock block = CreateAndProcessBlock({}, CScript()); - const uint256 blockHash = block.GetHash(); + const BlockHash blockHash = block.GetHash(); const CBlockIndex *pindex = mapBlockIndex[blockHash]; // Starting the event loop. diff --git a/src/test/blockencodings_tests.cpp b/src/test/blockencodings_tests.cpp --- a/src/test/blockencodings_tests.cpp +++ b/src/test/blockencodings_tests.cpp @@ -38,7 +38,7 @@ block.vtx.resize(3); block.vtx[0] = MakeTransactionRef(tx); block.nVersion = 42; - block.hashPrevBlock = InsecureRand256(); + block.hashPrevBlock = BlockHash(InsecureRand256()); block.nBits = 0x207fffff; tx.vin[0].prevout = InsecureRandOutPoint(); @@ -349,7 +349,7 @@ block.vtx.resize(1); block.vtx[0] = MakeTransactionRef(std::move(coinbase)); block.nVersion = 42; - block.hashPrevBlock = InsecureRand256(); + block.hashPrevBlock = BlockHash(InsecureRand256()); block.nBits = 0x207fffff; bool mutated; @@ -391,7 +391,7 @@ BOOST_AUTO_TEST_CASE(TransactionsRequestSerializationTest) { BlockTransactionsRequest req1; - req1.blockhash = InsecureRand256(); + req1.blockhash = BlockHash(InsecureRand256()); req1.indices.resize(4); req1.indices[0] = 0; req1.indices[1] = 1; diff --git a/src/test/blockindex_tests.cpp b/src/test/blockindex_tests.cpp --- a/src/test/blockindex_tests.cpp +++ b/src/test/blockindex_tests.cpp @@ -91,18 +91,17 @@ CBlockIndex index = CBlockIndex(); /* Test with all 0 hash */ - const uint256 zeroHash = uint256(); + const BlockHash zeroHash = BlockHash(); index.phashBlock = &zeroHash; - uint256 hash = index.GetBlockHash(); + BlockHash hash = index.GetBlockHash(); BOOST_CHECK(hash == zeroHash); /* Test with a random hash */ - std::vector hashBytes(32); - + uint256 hashBytes; std::generate(hashBytes.begin(), hashBytes.end(), []() { return uint8_t(rand() % 255); }); - const uint256 randomHash = uint256(hashBytes); + const BlockHash randomHash = BlockHash(hashBytes); index.phashBlock = &randomHash; hash = index.GetBlockHash(); BOOST_CHECK(hash == randomHash); @@ -189,7 +188,7 @@ header.hashMerkleRoot = uint256(); CBlockIndex index = CBlockIndex(header); - const uint256 hashBlock = uint256(); + const BlockHash hashBlock = BlockHash(); index.phashBlock = &hashBlock; index.nHeight = 123; @@ -254,7 +253,7 @@ "hashBlock=" "000000000000000000000000000000000000000000000000fedcba9876543210)", &indexPrev); - const uint256 emptyHashBlock = uint256S("FEDCBA9876543210"); + const BlockHash emptyHashBlock = BlockHash::fromHex("FEDCBA9876543210"); index.phashBlock = &emptyHashBlock; indexString = index.ToString(); BOOST_CHECK_EQUAL(indexString, expectedString); diff --git a/src/test/checkpoints_tests.cpp b/src/test/checkpoints_tests.cpp --- a/src/test/checkpoints_tests.cpp +++ b/src/test/checkpoints_tests.cpp @@ -27,9 +27,9 @@ BOOST_AUTO_TEST_CASE(sanity) { const auto params = CreateChainParams(CBaseChainParams::MAIN); const CCheckpointData &checkpoints = params->Checkpoints(); - uint256 p11111 = uint256S( + BlockHash p11111 = BlockHash::fromHex( "0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d"); - uint256 p134444 = uint256S( + BlockHash p134444 = BlockHash::fromHex( "00000000000005b12ffd4cd315cd34ffd4a594f430ac814c91184a0d42d2b0fe"); BOOST_CHECK(Checkpoints::CheckBlock(checkpoints, 11111, p11111)); BOOST_CHECK(Checkpoints::CheckBlock(checkpoints, 134444, p134444)); @@ -89,8 +89,8 @@ static std::unique_ptr createChainParams() { CCheckpointData checkpoints = { .mapCheckpoints = { - {2, uint256S("000000006a625f06636b8bb6ac7b960a8d0" - "3705d1ace08b1a19da3fdcc99ddbd")}, + {2, BlockHash::fromHex("000000006a625f06636b8bb6ac7b960a8d03705" + "d1ace08b1a19da3fdcc99ddbd")}, }}; const auto mainParams = CreateChainParams(CBaseChainParams::MAIN); return std::make_unique(*mainParams, diff --git a/src/test/coins_tests.cpp b/src/test/coins_tests.cpp --- a/src/test/coins_tests.cpp +++ b/src/test/coins_tests.cpp @@ -8,7 +8,6 @@ #include #include