Before this, if someone imported a scriptPubKey directly (in hex form) using importaddress
, outputs sending to it would be treated as change, as the corresponding CTxDestination was not added to the address book.
Fix this by trying to detect scriptPubKeys that are in fact convertible to a CTxDestination and add them anyway. Add a warning to the RPC help to warn against importing raw non-standard scripts.
Open question: should the RPC fail/warn in some way when this conversion is not possible? Things like listunspent
work fine with such outputs, but listtransactions
won’t.