Importing a descriptor with a label, i expected to be able to use it to filter UTxOs per descriptor in - EDIT: labels are disabled for range descriptors, see the second comment.listunspent. It's possible using the addr() descriptor but not with a non "opaque" one. I'm not sure what the expected behaviour here is, but it is inconsistent between the two and doesn't seem to be implied by the help:
"label": "str", (string, optional, default="") Label to assign to the address, only allowed with internal=false
A repro on regtest follows.
With multi() (not active)
createwallet desc true true "" false true
{
"name": "desc",
"warning": "Empty string given as passphrase, wallet will not be encrypted.\nWallet is an experimental descriptor wallet"
}
-rpcwallet=desc importdescriptors '[{"desc":"wsh(multi(1,tpubD6NzVbkrYhZ4X1zm1SuRG3uzkbjY5iVaDSZ8HfUDwEhMA5DtP6ebV1iR42eXKjxU7SAtf4PVHTVvbPqaTTisxH5Le8ynt2QSQNvZjTZWqwV/*,tpubD6NzVbkrYhZ4Wx4iTSmZQJWE6PsHR32TbeLGPoDNpoHHmeMR8RmHiAfco2npEzHLY8nmSNrKM5c7coGkaQwriSAnrXUfW6cQVw64Haj7aRv/*))#qw8vdw82","timestamp":"now","la
bel":"testlabel"}]'
[
{
"success": true,
"warnings": [
"Range not given, using default keypool range"
]
}
]
-rpcwallet=desc deriveaddresses "wsh(multi(1,tpubD6NzVbkrYhZ4X1zm1SuRG3uzkbjY5iVaDSZ8HfUDwEhMA5DtP6ebV1iR42eXKjxU7SAtf4PVHTVvbPqaTTisxH5Le8ynt2QSQNvZjTZWqwV/*,tpubD6NzVbkrYhZ4Wx4iTSmZQJWE6PsHR32TbeLGPoDNpoHHmeMR8RmHiAfco2npEzHLY8nmSNrKM5c7coGkaQwriSAnrXUfW6cQVw64Haj7aRv/*))#qw8vdw82" 1
[
"bcrt1qmwhug9v6j9gehpwzv0vaan7qlv2dnhak2rjetuw0cwawe8d22p5qtj0xru",
"bcrt1qhnzlvkn2cq3pq786j5l8vr23d4wv7hafumn87ysx7wckydcxyr4sxz53y7"
]
sendtoaddress bcrt1qhnzlvkn2cq3pq786j5l8vr23d4wv7hafumn87ysx7wckydcxyr4sxz53y7 1
c06e372849ecb41ca879939d558dfd071451dd7ae37f82f8971885428fa0e2ac
-rpcwallet=desc listunspent 0
[
{
"txid": "c06e372849ecb41ca879939d558dfd071451dd7ae37f82f8971885428fa0e2ac",
"vout": 0,
"address": "bcrt1qhnzlvkn2cq3pq786j5l8vr23d4wv7hafumn87ysx7wckydcxyr4sxz53y7",
"witnessScript": "512102002ce4dcd76b141d6fc3b87333bb487be0420a7b6c262486612e973ff67d480d210347c912c52c73fd5d9e676efae6daeceafb6d2e7e506e802a4d256d135b74b6d852ae",
"scriptPubKey": "0020bcc5f65a6ac0221078fa953e760d516d5ccf5fa9e6e67f1206f3b162370620eb",
"amount": 1.00000000,
"confirmations": 0,
"spendable": true,
"solvable": true,
"desc": "wsh(multi(1,[cb5d6fba/1]02002ce4dcd76b141d6fc3b87333bb487be0420a7b6c262486612e973ff67d480d,[a5461cc7/1]0347c912c52c73fd5d9e676efae6daeceafb6d2e7e506e802a4d256d135b74b6d8))#hh5argze",
"safe": false
}
]
And once confirmed:
-rpcwallet=desc listunspent
[
{
"txid": "c06e372849ecb41ca879939d558dfd071451dd7ae37f82f8971885428fa0e2ac",
"vout": 0,
"address": "bcrt1qhnzlvkn2cq3pq786j5l8vr23d4wv7hafumn87ysx7wckydcxyr4sxz53y7",
"witnessScript": "512102002ce4dcd76b141d6fc3b87333bb487be0420a7b6c262486612e973ff67d480d210347c912c52c73fd5d9e676efae6daeceafb6d2e7e506e802a4d256d135b74b6d852ae",
"scriptPubKey": "0020bcc5f65a6ac0221078fa953e760d516d5ccf5fa9e6e67f1206f3b162370620eb",
"amount": 1.00000000,
"confirmations": 1,
"spendable": true,
"solvable": true,
"desc": "wsh(multi(1,[cb5d6fba/1]02002ce4dcd76b141d6fc3b87333bb487be0420a7b6c262486612e973ff67d480d,[a5461cc7/1]0347c912c52c73fd5d9e676efae6daeceafb6d2e7e506e802a4d256d135b74b6d8))#hh5argze",
"safe": true
}
]
With multi(), imported as active
Interestingly, the behaviour is slightly different if the descriptor was imported as active: the label gets set to the default.
-rpcwallet=desc listunspent 0
[
{
"txid": "4d210ea111d4b195dbbb9ef9c41adbd593a15abd474186c1db1345adebfd6a29",
"vout": 1,
"address": "bcrt1qmwhug9v6j9gehpwzv0vaan7qlv2dnhak2rjetuw0cwawe8d22p5qtj0xru",
"label": "",
"witnessScript": "512102a52540cdedb82efaf7f2f2a95e1934fe69fd4d6b2c1e7875d29a71e751e35234210389887d9cc54cd6e1eaabd16cd003779882fa51d2c524741f38aae526211ec8ea52ae",
"scriptPubKey": "0020dbafc4159a91519b85c263d9decfc0fb14d9dfb650e595f1cfc3baec9daa5068",
"amount": 1.00000000,
"confirmations": 0,
"ancestorcount": 1,
"ancestorsize": 165,
"ancestorfees": 165,
"spendable": true,
"solvable": true,
"desc": "wsh(multi(1,[cb5d6fba/0]02a52540cdedb82efaf7f2f2a95e1934fe69fd4d6b2c1e7875d29a71e751e35234,[a5461cc7/0]0389887d9cc54cd6e1eaabd16cd003779882fa51d2c524741f38aae526211ec8ea))#e7u440ul",
"safe": false
}
]
With addr() (inactive, but active status doesn't matter)
createwallet descaddr true true "" false true
{
"name": "descaddr",
"warning": "Empty string given as passphrase, wallet will not be encrypted.\nWallet is an experimental descriptor wallet"
}
-rpcwallet=descaddr importdescriptors '[{"desc":"addr(bcrt1qhnzlvkn2cq3pq786j5l8vr23d4wv7hafumn87ysx7wckydcxyr4sxz53y7)#duqgr8lc","timestamp":0,"label":"foraddrdescriptorsitworks"}]'
[
{
"success": true
}
]
-rpcwallet=descaddr listunspent
[
{
"txid": "c06e372849ecb41ca879939d558dfd071451dd7ae37f82f8971885428fa0e2ac",
"vout": 0,
"address": "bcrt1qhnzlvkn2cq3pq786j5l8vr23d4wv7hafumn87ysx7wckydcxyr4sxz53y7",
"label": "foraddrdescriptorsitworks",
"scriptPubKey": "0020bcc5f65a6ac0221078fa953e760d516d5ccf5fa9e6e67f1206f3b162370620eb",
"amount": 1.00000000,
"confirmations": 1,
"spendable": true,
"solvable": false,
"safe": true
}
]