Skip to content

Commit

Permalink
fixed unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
OwenRay committed Oct 1, 2018
1 parent 5ec2d06 commit 0ac757f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
1 change: 0 additions & 1 deletion src/test/miner_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,6 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
mempool.addUnchecked(hash, entry.Fee(LOWFEE).Time(GetTime()).SpendsCoinbase(false).FromTx(tx));
BOOST_CHECK_THROW(BlockAssembler(chainparams).CreateNewBlock(scriptPubKey), std::runtime_error);
mempool.clear();
printf("??");

// invalid (pre-p2sh) txn in mempool, template creation fails
tx.vin[0].prevout.hash = txFirst[0]->GetHash();
Expand Down
8 changes: 2 additions & 6 deletions src/test/subsidy_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,21 @@ BOOST_AUTO_TEST_CASE(block_subsidy_test)
int32_t nPrevHeight;
CAmount nSubsidy;

// details for block 4249 (subsidy returned will be for block 4250)
nPrevBits = 0x1c4a47c4;
nPrevHeight = 262770;
nSubsidy = GetBlockSubsidy(nPrevBits, nPrevHeight, consensusParams, false);
BOOST_CHECK_EQUAL(nSubsidy, 2600000000ULL);
BOOST_CHECK_EQUAL(nSubsidy, 2383333334ULL);

// details for block 4501 (subsidy returned will be for block 4502)
nPrevBits = 0x1c4a47c4;
nPrevHeight = 262801;
nSubsidy = GetBlockSubsidy(nPrevBits, nPrevHeight, consensusParams, false);
BOOST_CHECK_EQUAL(nSubsidy, 2383333334ULL);

// details for block 5464 (subsidy returned will be for block 5465)
nPrevBits = 0x1c29ec00;
nPrevHeight = 525599;
nSubsidy = GetBlockSubsidy(nPrevBits, nPrevHeight, consensusParams, false);
BOOST_CHECK_EQUAL(nSubsidy, 2383333334ULL);
BOOST_CHECK_EQUAL(nSubsidy, 2184722223ULL);

// details for block 5465 (subsidy returned will be for block 5466)
nPrevBits = 0x1c29ec00;
nPrevHeight = 525601;
nSubsidy = GetBlockSubsidy(nPrevBits, nPrevHeight, consensusParams, false);
Expand Down
4 changes: 2 additions & 2 deletions src/test/transaction_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ BOOST_AUTO_TEST_CASE(tx_valid)
CTransaction tx(deserialize, stream);

CValidationState state;
BOOST_CHECK_MESSAGE(CheckTransaction(tx, state, false), strTest);
BOOST_CHECK_MESSAGE(CheckTransaction(tx, state), strTest);
BOOST_CHECK(state.IsValid());

for (unsigned int i = 0; i < tx.vin.size(); i++)
Expand Down Expand Up @@ -241,7 +241,7 @@ BOOST_AUTO_TEST_CASE(basic_transaction_tests)
CMutableTransaction tx;
stream >> tx;
CValidationState state;
BOOST_CHECK_MESSAGE(CheckTransaction(tx, state, false) && state.IsValid(), "Simple deserialized transaction should be valid.");
BOOST_CHECK_MESSAGE(CheckTransaction(tx, state) && state.IsValid(), "Simple deserialized transaction should be valid.");

// Check that duplicate txins fail
tx.vin.push_back(tx.vin[0]);
Expand Down

0 comments on commit 0ac757f

Please sign in to comment.