Firstly, what's the correct syntax? The comment in the code says
([sig ...] num_of_signatures [pubkey ...] num_of_pubkeys -- bool)
but how many signatures are present in [sig ...]? Is num_of_signatures the actual number of signatures provided or is it the number of valid signatures required for OP_CHECKMULTISIG to return true?
I'm reading the code for OP_CHECKMULTISIG in script.cpp
. It allows for fewer signatures than public keys but seems to iterate through both the signatures and public keys without any attempt to find out which ones are missing. I don't see how this could work for even a 1 of 2 multisignature transaction in both cases where, in the first case the signature matches the first public key and in the second case the signature matches the second public key.
Even if both signatures are provided but one is just invalid, the verification will fail as nSigsCount will only be 1 and if the first verification fails, the other will not even be attempted.
Can anyone explain please? The issue is becoming relevant...