Skip to content

Commit

Permalink
Unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
panleone authored and Duddino committed Sep 14, 2023
1 parent 4b06f01 commit a739006
Show file tree
Hide file tree
Showing 3 changed files with 366 additions and 48 deletions.
19 changes: 10 additions & 9 deletions src/test/test_pivx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,15 +201,16 @@ CBlock TestChainSetup::CreateBlock(const std::vector<CMutableTransaction>& txns,
CBlockIndex* customPrevBlock)
{
std::unique_ptr<CBlockTemplate> pblocktemplate = BlockAssembler(
Params(), DEFAULT_PRINTPRIORITY).CreateNewBlock(scriptPubKey,
nullptr, // wallet
false, // fProofOfStake
nullptr, // availableCoins
fNoMempoolTx,
fTestBlockValidity,
customPrevBlock,
true,
fIncludeQfc);
Params(), DEFAULT_PRINTPRIORITY)
.CreateNewBlock(scriptPubKey,
nullptr, // wallet
false, // fProofOfStake
{}, // availableCoins
fNoMempoolTx,
fTestBlockValidity,
customPrevBlock,
true,
fIncludeQfc);
std::shared_ptr<CBlock> pblock = std::make_shared<CBlock>(pblocktemplate->block);

// Add passed-in txns:
Expand Down
4 changes: 2 additions & 2 deletions src/test/validation_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ BOOST_FIXTURE_TEST_CASE(test_simple_shielded_invalid, TestingSetup)
CMutableTransaction newTx(tx);
CValidationState state;

// Create a coinstake transaction
// Create a mixed transaction with an empty vout and sapling data (so it isn't neither coinstake nor coinshieldstake)
CTxIn vin;
vin.prevout = COutPoint(UINT256_ZERO, 0);
newTx.vin.emplace_back(vin);
Expand All @@ -90,7 +90,7 @@ BOOST_FIXTURE_TEST_CASE(test_simple_shielded_invalid, TestingSetup)
newTx.sapData->vShieldedSpend.emplace_back();

BOOST_CHECK(!CheckTransaction(newTx, state, false));
BOOST_CHECK(state.GetRejectReason() == "bad-txns-invalid-sapling");
BOOST_CHECK(state.GetRejectReason() == "bad-txns-vout-empty");
}
}

Expand Down
Loading

0 comments on commit a739006

Please sign in to comment.