Make sure transactions have non-empty outputs

This commit is contained in:
Eirik Ogilvie-Wigley
2018-04-26 15:24:59 -06:00
parent a2ff78620a
commit 4b4662b06d
2 changed files with 18 additions and 3 deletions

View File

@@ -408,6 +408,16 @@ void test_simple_sapling_invalidity(uint32_t consensusBranchId, CMutableTransact
BOOST_CHECK(!CheckTransactionWithoutProofVerification(newTx, state));
BOOST_CHECK(state.GetRejectReason() == "bad-txns-vin-empty");
}
{
CMutableTransaction newTx(tx);
CValidationState state;
newTx.vShieldedSpend.push_back(SpendDescription());
newTx.vShieldedSpend[0].nullifier = GetRandHash();
BOOST_CHECK(!CheckTransactionWithoutProofVerification(newTx, state));
BOOST_CHECK(state.GetRejectReason() == "bad-txns-vout-empty");
}
{
// Ensure that nullifiers are never duplicated within a transaction.
CMutableTransaction newTx(tx);
@@ -415,6 +425,9 @@ void test_simple_sapling_invalidity(uint32_t consensusBranchId, CMutableTransact
newTx.vShieldedSpend.push_back(SpendDescription());
newTx.vShieldedSpend[0].nullifier = GetRandHash();
newTx.vShieldedOutput.push_back(OutputDescription());
newTx.vShieldedSpend.push_back(SpendDescription());
newTx.vShieldedSpend[1].nullifier = newTx.vShieldedSpend[0].nullifier;