LCOV - code coverage report
Current view: top level - src/wallet/test - pos_test_fixture.cpp (source / functions) Hit Total Coverage
Test: total_coverage.info Lines: 21 21 100.0 %
Date: 2025-02-23 09:33:43 Functions: 2 2 100.0 %

          Line data    Source code
       1             : // Copyright (c) 2021 The PIVX Core developers
       2             : // Distributed under the MIT software license, see the accompanying
       3             : // file COPYING or https://www.opensource.org/licenses/mit-license.php.
       4             : 
       5             : #include "wallet/test/pos_test_fixture.h"
       6             : #include "wallet/wallet.h"
       7             : 
       8             : #include <boost/test/unit_test.hpp>
       9             : 
      10           2 : TestPoSChainSetup::TestPoSChainSetup() : TestChainSetup(0)
      11             : {
      12           2 :     initZKSNARKS(); // init zk-snarks lib
      13             : 
      14           2 :     bool fFirstRun;
      15           2 :     pwalletMain = std::make_unique<CWallet>("testWallet", WalletDatabase::CreateMock());
      16           2 :     pwalletMain->LoadWallet(fFirstRun);
      17           2 :     RegisterValidationInterface(pwalletMain.get());
      18             : 
      19           2 :     {
      20           2 :         LOCK(pwalletMain->cs_wallet);
      21           2 :         pwalletMain->SetMinVersion(FEATURE_SAPLING);
      22           4 :         gArgs.ForceSetArg("-keypool", "5");
      23           2 :         pwalletMain->SetupSPKM(true);
      24             : 
      25             :         // import coinbase key used to generate the 100-blocks chain
      26           4 :         BOOST_CHECK(pwalletMain->AddKeyPubKey(coinbaseKey, coinbaseKey.GetPubKey()));
      27             :     }
      28             : 
      29           2 :     int posActivation = Params().GetConsensus().vUpgrades[Consensus::UPGRADE_POS].nActivationHeight - 1;
      30         502 :     for (int i = 0; i < posActivation; i++) {
      31        1000 :         CBlock b = CreateAndProcessBlock({}, coinbaseKey);
      32         500 :         coinbaseTxns.emplace_back(*b.vtx[0]);
      33             :     }
      34           2 : }
      35             : 
      36           4 : TestPoSChainSetup::~TestPoSChainSetup()
      37             : {
      38           2 :     SyncWithValidationInterfaceQueue();
      39           2 :     UnregisterValidationInterface(pwalletMain.get());
      40           2 : }

Generated by: LCOV version 1.14