In v0.17.1, importing a p2wsh-in-p2sh multisig address as watchonly+solvable requires importing it as two separate addresses, once with each of the two scripts. See my question on StackExchange.
In the current bitcoin master (d8794a78a887a920276c7124f1c46d69592c6c4e), this breaks, I suspect due to #14454. While that PR is a nice improvement, isn't it bad to break backward compatibility?
Problem
I want to import a p2wsh-in-p2sh multisig address as watchonly+solvable. I run:
bitcoin-cli -testnet importmulti '[{"redeemscript": "5221035a0cf2b8ad46945154d80b339f730ac0cdbc39a95550a95821adf6df6e6e3c9421038f339e9149fda8496360d689b5d6b4d66f8e64e28b1c89846efd0831512eab882103442945263f31819baf5799dc9595eba49b8f6674dadf21189f717abd630ab15053ae", "scriptPubKey": {"address": "2MvQKEWTdtH7uM5C72quuMukWNFkFYjm34N"}, "timestamp": "now"}, {"redeemscript": "0020d017965b0cae52a8b6f6e43b00118be27dae84b825959dcb77ca6b5310e53ea3", "scriptPubKey": {"address": "2MvQKEWTdtH7uM5C72quuMukWNFkFYjm34N"}, "timestamp": "now"}]'
The result comes back as:
[
{
"success": true,
"warnings": [
"Importing as non-solvable: redeemScript does not match the scriptPubKey. If this is intentional, don't provide any keys, pubkeys, witnessscript, or redeemscript."
]
},
{
"success": true,
"warnings": [
"Importing as non-solvable: missing witnessscript. If this is intentional, don't provide any keys, pubkeys, witnessscript, or redeemscript."
]
}
]
And then getaddressinfo shows that it is not solvable:
{
"address": "2MvQKEWTdtH7uM5C72quuMukWNFkFYjm34N",
"scriptPubKey": "a91422a07fe0ea8b8293eb336b9423f7e3958917924387",
"ismine": false,
"solvable": false,
"iswatchonly": true,
"isscript": true,
"iswitness": false,
"label": "",
"ischange": false,
"timestamp": 1296688602,
"labels": [
{
"name": "",
"purpose": "receive"
}
]
}
Firstly, is it okay for the importmulti to report success:true when some of the provided information was ignored? That seems...not good.
Secondly, how can I import this address in a way that will work on both v0.17.1 and (future) v0.18?
v0.17.1 behavior
Address is imported successfully:
[
{
"success": true
},
{
"success": true
}
]
And the getaddressinfo shows everything I expect:
{
"address": "2MvQKEWTdtH7uM5C72quuMukWNFkFYjm34N",
"scriptPubKey": "a91422a07fe0ea8b8293eb336b9423f7e3958917924387",
"ismine": false,
"iswatchonly": true,
"isscript": true,
"iswitness": false,
"script": "witness_v0_scripthash",
"hex": "0020d017965b0cae52a8b6f6e43b00118be27dae84b825959dcb77ca6b5310e53ea3",
"embedded": {
"isscript": true,
"iswitness": true,
"witness_version": 0,
"witness_program": "d017965b0cae52a8b6f6e43b00118be27dae84b825959dcb77ca6b5310e53ea3",
"script": "multisig",
"hex": "5221035a0cf2b8ad46945154d80b339f730ac0cdbc39a95550a95821adf6df6e6e3c9421038f339e9149fda8496360d689b5d6b4d66f8e64e28b1c89846efd0831512eab882103442945263f31819baf5799dc9595eba49b8f6674dadf21189f717abd630ab15053ae",
"sigsrequired": 2,
"pubkeys": [
"035a0cf2b8ad46945154d80b339f730ac0cdbc39a95550a95821adf6df6e6e3c94",
"038f339e9149fda8496360d689b5d6b4d66f8e64e28b1c89846efd0831512eab88",
"03442945263f31819baf5799dc9595eba49b8f6674dadf21189f717abd630ab150"
],
"address": "tb1q6qtevkcv4ef23dhkusasqyvtuf76ap9cyk2emjmhef44xy89863s6yyfks",
"scriptPubKey": "0020d017965b0cae52a8b6f6e43b00118be27dae84b825959dcb77ca6b5310e53ea3"
},
"label": "",
"timestamp": 1296688602,
"labels": [
{
"name": "",
"purpose": "receive"
}
]
}