PushedData returns an array of byte slices containing any pushed data
found in the passed script. This includes OP_0, but not OP_1 - OP_16.
help from and ok @owainga
This commit corrects the number of expected inputs for a multi-sig script
to include the additional item that is popped from the stack due to the
OP_CHECKMULTISIG consensus bug (which is required and properly performed).
Note this issue did NOT affect the consensus critical code and hence would
not cause a chain fork. It did however, cause standard p2sh multisig txns
to be rejected from the mempool as nonstandard.
The tx rejected as non-standard which prompted this was spotted by
@mbelshe on IRC.
ok @owainga
Also, unexport the functions to generate script types. Everything should
(and is) be using PayToAddrScript() with an address type instead of
throwing bytes around.
discussed with #@davecgh
This removes the bip16 bool from NewScript and adds it to flags (with
the constant ScriptBip16), and also adds a new flag,
ScriptCanonicalSignatures, which will call btcec.ParseDERSignature
parsing a signature during an Execute. This is needed to emulate
bitcoind behavior, as bitcoind performs canonical signature validation
(DER format) in some places (like mempool acceptance) but not others
(like block validation).
Updated tests and test coverage file to reflect changes.
So add entries for them that disassemble and parse ok, but will fail
when executed with the appropriate error. Add a full suite of tests to confirm
that this happens.
Found by a strange transaction in testnet.
PayToPubKeyHashScript generates a new pay to pubkey hash script to use
as the pkScript when creating new transactions. If the passed pubkey
hash is an invalid size, StackErrInvalidOpcode will be returned as an
error.
SignatureScript returns the signature script necessary to validate a
single input of a transaction.
This also adds sanity checking for serializing scripts into byte
slices. If the length of a serialized opcode does not equal the
expected length, StackErrInvalidOpcode will be returned when unparsing
a []parsedOpcode.
New internal tests were added to verify checks for valid and invalid
parsed opcodes.
This commit modifies the code to no longer require a protocol version. It
does this by making use of the new Serialize function in btcwire.
Unfortuantely this does entail a public API change which I generally don't
like to do, but eliminating the usage of the protocol version throughout
the codebase was important enough to warrant the change.
To be usd for validation. Most of the codepaths teste, a few tests
missing for cases needed tests in the validation codepaths too. To be
worked on in tree.
Use this to test the pubkey paths in checksig which return btcec errors
which we don't define. all of the other active tests know the return
code we need.