Currently our wallet code will treat bare multisig outputs (meaning scriptPubKeys with multiple public keys + OP_CHECKMULTISIG
operator in it) as ours without the user asking for it, as long as all public keys in it are ours.
These are:
- hard to test (as there is no explicit address format for them)
- expensive to spend (need multiple signatures)
- wasteful (require more space in the UTXO set than P2PKH/P2SH/P2WPK/P2WSH)
- generally pointless (you won’t use multisig just for public keys that are all in the same wallet)
Furthermore, they are problematic in that means that producing a list of all scriptPubKeys
we accept is not tractable (it involves all combinations of all public keys that are ours). In further wallet changes I’d like to move to a model where all scriptPubKeys that are treated as ours are explicit, rather than defined by whatever keys we have. The current behavior of the wallet is very hard to model in such a design, so I’d like to get rid of it.
I think there are two options:
- Remove it entirely (do not ever accept bare multisig outputs as ours)
- Only accept bare multisig outputs in situations where the P2SH version of that output would also be acceptable
This PR implements the second, though I’m open to discussing the first option.