diff options
Diffstat (limited to 'src/test/util.cpp')
-rw-r--r-- | src/test/util.cpp | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/src/test/util.cpp b/src/test/util.cpp index ed031270f2..e775ad323b 100644 --- a/src/test/util.cpp +++ b/src/test/util.cpp @@ -4,15 +4,9 @@ #include <test/util.h> -#include <chainparams.h> -#include <consensus/merkle.h> #include <key_io.h> -#include <miner.h> #include <outputtype.h> -#include <pow.h> #include <script/standard.h> -#include <validation.h> -#include <validationinterface.h> #ifdef ENABLE_WALLET #include <wallet/wallet.h> #endif @@ -44,41 +38,3 @@ void importaddress(CWallet& wallet, const std::string& address) wallet.SetAddressBook(dest, /* label */ "", "receive"); } #endif // ENABLE_WALLET - -CTxIn generatetoaddress(const std::string& address) -{ - const auto dest = DecodeDestination(address); - assert(IsValidDestination(dest)); - const auto coinbase_script = GetScriptForDestination(dest); - - return MineBlock(coinbase_script); -} - -CTxIn MineBlock(const CScript& coinbase_scriptPubKey) -{ - auto block = PrepareBlock(coinbase_scriptPubKey); - - while (!CheckProofOfWork(block->GetHash(), block->nBits, Params().GetConsensus())) { - ++block->nNonce; - assert(block->nNonce); - } - - bool processed{ProcessNewBlock(Params(), block, true, nullptr)}; - assert(processed); - - return CTxIn{block->vtx[0]->GetHash(), 0}; -} - -std::shared_ptr<CBlock> PrepareBlock(const CScript& coinbase_scriptPubKey) -{ - auto block = std::make_shared<CBlock>( - BlockAssembler{Params()} - .CreateNewBlock(coinbase_scriptPubKey) - ->block); - - LOCK(cs_main); - block->nTime = ::ChainActive().Tip()->GetMedianTimePast() + 1; - block->hashMerkleRoot = BlockMerkleRoot(*block); - - return block; -} |