For silent payments, we want to provide a SilentPaymentsDestination
to be used as the recipient, which requires CRecipient
to use something other than just the scriptPubKey
as we cannot know the output script for a silent payment prior to transaction creation. CTxDestination
seems like the obvious place to add a SilentPaymentsDestination
as it is our internal representation of an address.
In order to still allow paying to arbitrary scriptPubKeys (e.g. for data carrier outputs, or the user hand crafted a raw transaction that they have given to fundrawtransaction
), CNoDestination
is changed to contain raw scripts.
Additionally, P2PK scripts are now interpreted as a new PubKeyDestination
rather than PKHash
. This results in some things that would have given an address for P2PK scripts to no longer do so. This is arguably more correct.
ExtractDestination
’s behavior is slightly changed for the above. It now returns true
for those destinations that have addresses, so P2PK scripts now result in false
. Even though it returns false for CNoDestination
, the script will now be included in that CNoDestination
.
Builds on #28244