Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use p2pkh vout instead of p2pk for change when -pubkey specified #81

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3933,7 +3933,14 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
else
{
//LogPrintf("use notary pubkey\n");
scriptChange = CScript() << ParseHex(NOTARY_PUBKEY) << OP_CHECKSIG;

// 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
Loading