This new check here makes the flow more robust and avoids relying on implicit assumptions of what’s going on inside the Expand
function.
Instead of relying on implicit assumptions about whether pubkeys show up
after expanding a descriptor, just explicitly allow only single
key descriptors to import keys into a legacy wallet’s keypool.
The commit message 6a31eb5dca1f8eb5fd0507852b49c7452031269e, however, was difficult for me to parse. The second clause, which I understand (and made me wonder why), didn’t seem to follow the first. Only after reading this #31243#pullrequestreview-2436530611 PR comment, I understood the need for this commit that made me want to investigate the Imported scripts with pubkeys should not have their pubkeys go into the keypool
subtest in wallet_importmulti
functional test that fails without this new check or relying only on the out_keys.pubkeys.size() == 1
check (that I thought of trying) as a 1-of-1 multisig scenario ends up passing that test, which is not desired.
Legacy wallet keypool should not be updated with individual keys from multisig type scripts as per my understanding from this test. Was this the contract in the legacy wallet?
Some rephrasing of the commit message as per the above mention comment would be helpful.