Skip to content

Conversation

@starius
Copy link
Contributor

@starius starius commented Nov 7, 2025

If scriptPubKey is empty, we can't get &scriptPubKey[0] from it.

Also added nix dev shell so I can do nix develop and get all the dependencies loaded.

@stringintech
Copy link
Owner

stringintech commented Nov 7, 2025

Thanks for this and adding test coverage!
Would you mind opening a separate PR for the nix commit so I can give it more thought?
Also for the test, it seems it can be added as a new case in TestInvalidScripts():

		{
			name:            "empty_scriptpubkey",
			scriptPubkeyHex: "",
			amount:          0,
			// Minimal coinbase-style transaction with a single empty scriptSig and zero-value output;
			// used to trigger verification paths.
			txToHex:     "01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff00ffffffff0100000000000000000000000000",
			inputIndex:  0,
			description: "empty scriptPubkey should fail verification",
		},

Next to that, adding a scriptHex :="" case to TestScriptPubkeyFromRaw() would be good.

If scriptPubKey is empty, we can't get &scriptPubKey[0] from it.
@starius
Copy link
Contributor Author

starius commented Nov 7, 2025

@stringintech I removed Nix to another PR: #4
Added a test case for TestInvalidScripts and TestScriptPubkeyFromRaw.
Please take another look!

@stringintech stringintech merged commit 4e19882 into stringintech:main Nov 7, 2025
3 checks passed
@starius starius deleted the fix-panic branch November 7, 2025 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants