Skip to content

Commit 2651eaf

Browse files
authored
use p2pkh vout instead of p2pk for change when -pubkey specified (#638)
this will help Iguana identify the change UTXOs and use them for splitting.
1 parent 820fe50 commit 2651eaf

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/wallet/wallet.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -3843,6 +3843,13 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
38433843
else
38443844
{
38453845
//fprintf(stderr,"use notary pubkey\n");
3846+
3847+
// If a valid notary pubkey is passed, the change will be sent to the corresponding address
3848+
// as a standard P2PKH vout, not P2PK, so Iguana can easily split it, etc.
3849+
vchPubKey = CPubKey(ParseHex(NOTARY_PUBKEY));
3850+
if (vchPubKey.IsValid()) {
3851+
scriptChange = GetScriptForDestination(vchPubKey.GetID());
3852+
} else
38463853
scriptChange = CScript() << ParseHex(NOTARY_PUBKEY) << OP_CHECKSIG;
38473854
}
38483855
}

0 commit comments

Comments
 (0)