forked from dashpay/dash
-
Notifications
You must be signed in to change notification settings - Fork 716
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
69 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright (c) 2021 The PIVX developers | ||
// Distributed under the MIT software license, see the accompanying | ||
// file COPYING or https://www.opensource.org/licenses/mit-license.php. | ||
|
||
#include "wallet/test/pos_test_fixture.h" | ||
#include "wallet/wallet.h" | ||
|
||
#include <boost/test/unit_test.hpp> | ||
|
||
TestPoSChainSetup::TestPoSChainSetup() : TestChainSetup(0) | ||
{ | ||
initZKSNARKS(); // init zk-snarks lib | ||
|
||
bool fFirstRun; | ||
pwalletMain = std::make_unique<CWallet>("testWallet", CWalletDBWrapper::CreateMock()); | ||
pwalletMain->LoadWallet(fFirstRun); | ||
RegisterValidationInterface(pwalletMain.get()); | ||
|
||
{ | ||
LOCK(pwalletMain->cs_wallet); | ||
pwalletMain->SetMinVersion(FEATURE_SAPLING); | ||
gArgs.ForceSetArg("-keypool", "5"); | ||
pwalletMain->SetupSPKM(true); | ||
|
||
// import coinbase key used to generate the 100-blocks chain | ||
BOOST_CHECK(pwalletMain->AddKeyPubKey(coinbaseKey, coinbaseKey.GetPubKey())); | ||
} | ||
|
||
int posActivation = Params().GetConsensus().vUpgrades[Consensus::UPGRADE_POS].nActivationHeight - 1; | ||
for (int i = 0; i < posActivation; i++) { | ||
CBlock b = CreateAndProcessBlock({}, coinbaseKey); | ||
coinbaseTxns.emplace_back(*b.vtx[0]); | ||
} | ||
} | ||
|
||
TestPoSChainSetup::~TestPoSChainSetup() | ||
{ | ||
SyncWithValidationInterfaceQueue(); | ||
UnregisterValidationInterface(pwalletMain.get()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright (c) 2021 The PIVX developers | ||
// Distributed under the MIT software license, see the accompanying | ||
// file COPYING or https://www.opensource.org/licenses/mit-license.php. | ||
|
||
#ifndef PIVX_POS_TEST_FIXTURE_H | ||
#define PIVX_POS_TEST_FIXTURE_H | ||
|
||
#include "test/test_pivx.h" | ||
|
||
class CWallet; | ||
|
||
/* | ||
* A text fixture with a preloaded 250-blocks regtest chain running running on PoS | ||
* and a wallet containing the key used for the coinbase outputs. | ||
*/ | ||
struct TestPoSChainSetup: public TestChainSetup | ||
{ | ||
std::unique_ptr<CWallet> pwalletMain; | ||
|
||
TestPoSChainSetup(); | ||
~TestPoSChainSetup(); | ||
}; | ||
|
||
#endif // PIVX_POS_TEST_FIXTURE_H |