mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 07:09:15 +01:00
Add PubKeyDestination for P2PK scripts
P2PK scripts are not PKHash destinations, they should have their own type. This also results in no longer showing a p2pkh address for p2pk outputs. However for backwards compatibility, ListCoinst will still do this conversion.
This commit is contained in:
@@ -280,6 +280,11 @@ static RPCHelpMan deriveaddresses()
|
||||
for (const CScript& script : scripts) {
|
||||
CTxDestination dest;
|
||||
if (!ExtractDestination(script, dest)) {
|
||||
// ExtractDestination no longer returns true for P2PK since it doesn't have a corresponding address
|
||||
// However combo will output P2PK and should just ignore that script
|
||||
if (scripts.size() > 1 && std::get_if<PubKeyDestination>(&dest)) {
|
||||
continue;
|
||||
}
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Descriptor does not have a corresponding address");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user