Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Test Suite] Fix test for null tx input #6863

Merged
merged 1 commit into from Oct 29, 2015

Conversation

domob1812
Copy link
Contributor

Update the unittest that is meant to catch a transaction that is invalid because it has a null input. The old test failed not because of that but because it was considered a coinbase with too large script. This is already checked with a different test, though.

The new test is not a coinbase since it has two inputs, but one of them is null. This really checks the corresponding code path in CheckTransaction. If this check is disabled there in main.cpp, the old unittest still succeeded. It does no longer succeed with this patch.

@laanwj laanwj added the Tests label Oct 21, 2015
@laanwj
Copy link
Member

laanwj commented Oct 23, 2015

utACK

@laanwj
Copy link
Member

laanwj commented Oct 26, 2015

From @gmaxwell on IRC: Personally I would have put the 0100 input in the first position, for fear that some coinbase checking code only checks the nullness of the first input.

@petertodd
Copy link
Contributor

utACK

I'd test both first and second being the null. :)

@domob1812
Copy link
Contributor Author

Sounds like a reasonable plan! ;) I'll update the patch accordingly later today.

Update the unittest that is meant to catch a transaction that is invalid
because it has a null input.  The old test failed not because of that
but because it was considered a coinbase with too large script.  This is
already checked with a different test, though.

The new test is *not* a coinbase since it has two inputs, but one of
them is null.  This really checks the corresponding code path in
CheckTransaction.
@domob1812
Copy link
Contributor Author

Pushed the extended patch.

@petertodd
Copy link
Contributor

utACK

@jgarzik
Copy link
Contributor

jgarzik commented Oct 27, 2015

ut ACK

@sipa
Copy link
Member

sipa commented Oct 28, 2015

The new test contains a much more structured transaction only. Is there a reason to delete the previous one?

@domob1812
Copy link
Contributor Author

The previous test didn't do what it was advertised to do - it failed not because of the null txin but because of the coinbase length restriction. This is already tested by the preceding test, so I don't see much of a point in having two tests for that. But if you think it should stay, I can leave it in (but "fix" the comment for what it really tests).

@laanwj laanwj merged commit 0be387a into bitcoin:master Oct 29, 2015
laanwj added a commit that referenced this pull request Oct 29, 2015
0be387a unittest: fix test for null tx input (Daniel Kraft)
@domob1812 domob1812 deleted the null-txin-test branch October 29, 2015 14:28
domob1812 added a commit to domob1812/huntercore that referenced this pull request Nov 17, 2015
Adapt some of the existing and failing unit tests to the changed
parameters of Huntercoin.  Not yet updated and still failing are many
name tests.  Also one of the transaction tests is still failing, but
this seems to be related to a wrongly written test itself, see
bitcoin/bitcoin#6863.  Trying to get this merged
upstream instead of a custom fix here.

Furthermore, there are not yet any actual unit tests written newly for
Huntercoin or game logic in general.
luke-jr pushed a commit to luke-jr/bitcoin that referenced this pull request Nov 18, 2015
Update the unittest that is meant to catch a transaction that is invalid
because it has a null input.  The old test failed not because of that
but because it was considered a coinbase with too large script.  This is
already checked with a different test, though.

The new test is *not* a coinbase since it has two inputs, but one of
them is null.  This really checks the corresponding code path in
CheckTransaction.

Github-Pull: bitcoin#6863
Rebased-From: 0be387a
luke-jr pushed a commit to luke-jr/bitcoin that referenced this pull request Dec 8, 2015
Update the unittest that is meant to catch a transaction that is invalid
because it has a null input.  The old test failed not because of that
but because it was considered a coinbase with too large script.  This is
already checked with a different test, though.

The new test is *not* a coinbase since it has two inputs, but one of
them is null.  This really checks the corresponding code path in
CheckTransaction.

Github-Pull: bitcoin#6863
Rebased-From: 0be387a
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants