Skip to content

Commit

Permalink
use p2pkh vout instead of p2pk for change when -pubkey specified (#638)
Browse files Browse the repository at this point in the history
this will help Iguana identify the change UTXOs and use them for splitting.
  • Loading branch information
DeckerSU authored Oct 17, 2024
1 parent 820fe50 commit 2651eaf
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3843,6 +3843,13 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
else
{
//fprintf(stderr,"use notary pubkey\n");

// If a valid notary pubkey is passed, the change will be sent to the corresponding address
// as a standard P2PKH vout, not P2PK, so Iguana can easily split it, etc.
vchPubKey = CPubKey(ParseHex(NOTARY_PUBKEY));
if (vchPubKey.IsValid()) {
scriptChange = GetScriptForDestination(vchPubKey.GetID());
} else
scriptChange = CScript() << ParseHex(NOTARY_PUBKEY) << OP_CHECKSIG;
}
}
Expand Down

0 comments on commit 2651eaf

Please sign in to comment.