Skip to content

Commit fd5aed4

Browse files
committed
Comment output_pubkeys_out arg of ConstructTrasnaction; minor cleanup
1 parent 37be829 commit fd5aed4

2 files changed

Lines changed: 5 additions & 12 deletions

File tree

src/rpc/rawtransaction.cpp

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1953,21 +1953,12 @@ UniValue createpsbt(const JSONRPCRequest& request)
19531953
CMutableTransaction rawTx = ConstructTransaction(request.params[0], request.params[1], request.params[2], request.params[3], request.params[4], &output_pubkeys);
19541954

19551955
// Make a blank psbt
1956-
PartiallySignedTransaction psbtx;
1957-
psbtx.tx = rawTx;
1958-
for (unsigned int i = 0; i < rawTx.vin.size(); ++i) {
1959-
psbtx.inputs.push_back(PSBTInput());
1960-
}
1956+
PartiallySignedTransaction psbtx(rawTx);
19611957
for (unsigned int i = 0; i < rawTx.vout.size(); ++i) {
1962-
psbtx.outputs.push_back(PSBTOutput());
19631958
psbtx.outputs[i].blinding_pubkey = output_pubkeys[i];
19641959
}
19651960

1966-
// Serialize the PSBT
1967-
CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION);
1968-
ssTx << psbtx;
1969-
1970-
return EncodeBase64((unsigned char*)ssTx.data(), ssTx.size());
1961+
return EncodePSBT(psbtx);
19711962
}
19721963

19731964
UniValue converttopsbt(const JSONRPCRequest& request)

src/rpc/rawtransaction.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ class Chain;
1616
/** Sign a transaction with the given keystore and previous transactions */
1717
UniValue SignTransaction(interfaces::Chain& chain, CMutableTransaction& mtx, const UniValue& prevTxs, CBasicKeyStore *keystore, bool tempKeystore, const UniValue& hashType);
1818

19-
/** Create a transaction from univalue parameters */
19+
/** Create a transaction from univalue parameters. If (and only if)
20+
output_pubkeys_out is null, the "nonce hack" of storing Confidential
21+
Assets output pubkeys in nonces will be used. */
2022
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);
2123

2224
#endif // BITCOIN_RPC_RAWTRANSACTION_H

0 commit comments

Comments
 (0)