Skip to content

Commit

Permalink
script: Reinterpret P2PK scripts as PKHash
Browse files Browse the repository at this point in the history
  • Loading branch information
lateminer committed Feb 3, 2024
1 parent 5fd1146 commit 0be7fcf
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/addresstype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,24 @@ bool ExtractDestination(const CScript& scriptPubKey, CTxDestination& addressRet)
switch (whichType) {
case TxoutType::PUBKEY: {
CPubKey pubKey(vSolutions[0]);

/*
if (!pubKey.IsValid()) {
addressRet = CNoDestination(scriptPubKey);
} else {
addressRet = PubKeyDestination(pubKey);
}
return false;
*/

// Blackcoin: Reinterpret P2PK scripts as PKHash
// We need to do that because proof-of-stake mechanism uses P2PK outputs
// It partially reverts Bitcoin Core PR#28246 https://github.com/bitcoin/bitcoin/pull/28246
if (!pubKey.IsValid())
return false;

addressRet = PKHash(pubKey);
return true;
}
case TxoutType::PUBKEYHASH: {
addressRet = PKHash(uint160(vSolutions[0]));
Expand Down

0 comments on commit 0be7fcf

Please sign in to comment.