Skip to content

Commit 8edc005

Browse files
committed
Unit tests
1 parent f415357 commit 8edc005

File tree

3 files changed

+367
-48
lines changed

3 files changed

+367
-48
lines changed

src/test/test_pivx.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -201,15 +201,16 @@ CBlock TestChainSetup::CreateBlock(const std::vector<CMutableTransaction>& txns,
201201
CBlockIndex* customPrevBlock)
202202
{
203203
std::unique_ptr<CBlockTemplate> pblocktemplate = BlockAssembler(
204-
Params(), DEFAULT_PRINTPRIORITY).CreateNewBlock(scriptPubKey,
205-
nullptr, // wallet
206-
false, // fProofOfStake
207-
nullptr, // availableCoins
208-
fNoMempoolTx,
209-
fTestBlockValidity,
210-
customPrevBlock,
211-
true,
212-
fIncludeQfc);
204+
Params(), DEFAULT_PRINTPRIORITY)
205+
.CreateNewBlock(scriptPubKey,
206+
nullptr, // wallet
207+
false, // fProofOfStake
208+
{}, // availableCoins
209+
fNoMempoolTx,
210+
fTestBlockValidity,
211+
customPrevBlock,
212+
true,
213+
fIncludeQfc);
213214
std::shared_ptr<CBlock> pblock = std::make_shared<CBlock>(pblocktemplate->block);
214215

215216
// Add passed-in txns:

src/test/validation_tests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ BOOST_FIXTURE_TEST_CASE(test_simple_shielded_invalid, TestingSetup)
7777
CMutableTransaction newTx(tx);
7878
CValidationState state;
7979

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

9292
BOOST_CHECK(!CheckTransaction(newTx, state, false));
93-
BOOST_CHECK(state.GetRejectReason() == "bad-txns-invalid-sapling");
93+
BOOST_CHECK(state.GetRejectReason() == "bad-txns-vout-empty");
9494
}
9595
}
9696

0 commit comments

Comments
 (0)