Let's say I build a P2MS output script using uncompressed public keys, and let's say too that these public keys are not valid, i.e. they do not represent a valid EC Point and they don't start with 0x04. Will this transaction be broadcasted and included in a block or, among all the validity and standardness checks, a peer also controls that public keys are valid and rejects the transaction if they aren't ? Thank you very much !
2 Answers
The standardness check will verify a multisig output for valid EC points. If these points do not pass this verification, the output script will be considered non-standard and not propagated by the implementations which I know of.
This can be verified by checking the implementation source.
On transaction verification: maybe this and this. The funding transaction might find its way into the system, cause a script in a (P2SH) multisig is the hash of a redeemscript. A verification of the redeemscript cannot be done, unless the spending tx will be sent. If then incorrect keys are used in a script, then the checksig script will fail, and as such the whole transaction will be rejected. I haven't made a test with a non-redeem script. A non-P2SH (also called "raw") multisig would have in the funding transaction this lock script:
2 <Public Key A> <Public Key B> <Public Key C> 3 CHECKMULTISIG
I haven't seen that isStandard() checks the details of the public keys. Anyhow, the script has to have proper length parameters around the "invalid" keys, so script validation thinks, its just an array of hexadecimal data that shall be pushed onto the stack. And then again, data inside must not use OpCodes, which might be misinterpreted. So it's tricky, but not impossible. Need to have a proper understanding of bitcoin script though :-)