PIVX Core  5.6.99
P2P Digital Currency
pos_test_fixture.cpp
Go to the documentation of this file.
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 
6 #include "wallet/wallet.h"
7 
8 #include <boost/test/unit_test.hpp>
9 
11 {
12  initZKSNARKS(); // init zk-snarks lib
13 
14  bool fFirstRun;
15  pwalletMain = std::make_unique<CWallet>("testWallet", WalletDatabase::CreateMock());
16  pwalletMain->LoadWallet(fFirstRun);
18 
19  {
20  LOCK(pwalletMain->cs_wallet);
21  pwalletMain->SetMinVersion(FEATURE_SAPLING);
22  gArgs.ForceSetArg("-keypool", "5");
23  pwalletMain->SetupSPKM(true);
24 
25  // import coinbase key used to generate the 100-blocks chain
27  }
28 
30  for (int i = 0; i < posActivation; i++) {
32  coinbaseTxns.emplace_back(*b.vtx[0]);
33  }
34 }
35 
37 {
40 }
const CChainParams & Params()
Return the currently selected parameters.
void ForceSetArg(const std::string &strArg, const std::string &strValue)
Definition: system.cpp:489
static std::unique_ptr< BerkeleyDatabase > CreateMock()
Return object for accessing temporary in-memory database.
Definition: db.h:138
Definition: block.h:80
std::vector< CTransactionRef > vtx
Definition: block.h:83
const Consensus::Params & GetConsensus() const
Definition: chainparams.h:72
CPubKey GetPubKey() const
Compute the public key from a private key.
Definition: key.cpp:186
@ LOCK
Definition: lockunlock.h:16
@ UPGRADE_POS
Definition: params.h:28
#define BOOST_CHECK(expr)
Definition: object.cpp:17
int nActivationHeight
Height of the first block for which the new consensus rules will be active.
Definition: params.h:56
NetworkUpgrade vUpgrades[MAX_NETWORK_UPGRADES]
Definition: params.h:213
std::vector< CTransaction > coinbaseTxns
Definition: test_pivx.h:117
CBlock CreateAndProcessBlock(const std::vector< CMutableTransaction > &txns, const CScript &scriptPubKey, bool fNoMempoolTx=true)
Definition: test_pivx.cpp:184
CKey coinbaseKey
Definition: test_pivx.h:118
std::unique_ptr< CWallet > pwalletMain
void initZKSNARKS()
Definition: system.cpp:624
ArgsManager gArgs
Definition: system.cpp:89
void UnregisterValidationInterface(CValidationInterface *pwalletIn)
Unregister a wallet from core.
void RegisterValidationInterface(CValidationInterface *pwalletIn)
Register a wallet to receive updates from core.
void SyncWithValidationInterfaceQueue()
This is a synonym for the following, which asserts certain locks are not held: std::promise<void> pro...
@ FEATURE_SAPLING
Definition: wallet.h:118