user29432: I have a technical question regarding the signrawtransaction function in Bitcoin core when signing a partially-signed transaction.
I have tested different scenarios and signrawtransaction will always sort the signatures in the correct way in the scriptSig, regardless of the order the transaction is signed one-by-one. 
Is this achieved by analyzing the scriptSig of the partially-signed transaction when signing, and then verifying each signature in the partially-signed transactions scriptSig against all public keys in the redeemscript and finally ordering them correctly? Or is there a better way of doing this? 
Unfortunately I don't understand how this is done by reading the C-code of bitcoin core.

user12983: The signatures must be ordered the same way as public keys. Otherwize transaction is invalid. This is how OP_CHECKMULTISIG(VERIFY) works. 
Of course, you may use the private keys for signing in any order, because signatures are independent.

29432: <p>I have a technical question regarding the signrawtransaction function in Bitcoin core when signing a partially-signed transaction.</p>

<p>I have tested different scenarios and signrawtransaction will always sort the signatures in the correct way in the scriptSig, regardless of the order the transaction is signed one-by-one. </p>

<p>Is this achieved by analyzing the scriptSig of the partially-signed transaction when signing, and then verifying each signature in the partially-signed transactions scriptSig against all public keys in the redeemscript and finally ordering them correctly? Or is there a better way of doing this? </p>

<p>Unfortunately I don't understand how this is done by reading the C-code of bitcoin core.</p>
 12983: <p>The signatures must be ordered the same way as public keys. Otherwize transaction is invalid. This is how OP_CHECKMULTISIG(VERIFY) works. </p>

<p>Of course, you may use the private keys for signing in any order, because signatures are independent.</p>
