Skip to content

Commit

Permalink
Comment output_pubkeys_out arg of ConstructTrasnaction; minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
gwillen committed Jul 31, 2019
1 parent 37be829 commit fd5aed4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
13 changes: 2 additions & 11 deletions src/rpc/rawtransaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1953,21 +1953,12 @@ UniValue createpsbt(const JSONRPCRequest& request)
CMutableTransaction rawTx = ConstructTransaction(request.params[0], request.params[1], request.params[2], request.params[3], request.params[4], &output_pubkeys);

// Make a blank psbt
PartiallySignedTransaction psbtx;
psbtx.tx = rawTx;
for (unsigned int i = 0; i < rawTx.vin.size(); ++i) {
psbtx.inputs.push_back(PSBTInput());
}
PartiallySignedTransaction psbtx(rawTx);
for (unsigned int i = 0; i < rawTx.vout.size(); ++i) {
psbtx.outputs.push_back(PSBTOutput());
psbtx.outputs[i].blinding_pubkey = output_pubkeys[i];
}

// Serialize the PSBT
CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION);
ssTx << psbtx;

return EncodeBase64((unsigned char*)ssTx.data(), ssTx.size());
return EncodePSBT(psbtx);
}

UniValue converttopsbt(const JSONRPCRequest& request)
Expand Down
4 changes: 3 additions & 1 deletion src/rpc/rawtransaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ class Chain;
/** Sign a transaction with the given keystore and previous transactions */
UniValue SignTransaction(interfaces::Chain& chain, CMutableTransaction& mtx, const UniValue& prevTxs, CBasicKeyStore *keystore, bool tempKeystore, const UniValue& hashType);

/** Create a transaction from univalue parameters */
/** Create a transaction from univalue parameters. If (and only if)
output_pubkeys_out is null, the "nonce hack" of storing Confidential
Assets output pubkeys in nonces will be used. */
CMutableTransaction ConstructTransaction(const UniValue& inputs_in, const UniValue& outputs_in, const UniValue& locktime, const UniValue& rbf, const UniValue& assets_in, std::vector<CPubKey>* output_pubkeys_out = nullptr);

#endif // BITCOIN_RPC_RAWTRANSACTION_H

0 comments on commit fd5aed4

Please sign in to comment.