mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-20 14:05:23 +01:00
refactor: move normalization to new function
Move the univalue formatting logic out of AddOutputs and into its own function, `NormalizeOutputs`. This allows us to re-use this logic in later commits.
This commit is contained in:
parent
435fe5cd96
commit
6f569ac903
2 changed files with 12 additions and 2 deletions
|
@ -70,7 +70,7 @@ void AddInputs(CMutableTransaction& rawTx, const UniValue& inputs_in, std::optio
|
|||
}
|
||||
}
|
||||
|
||||
void AddOutputs(CMutableTransaction& rawTx, const UniValue& outputs_in)
|
||||
UniValue NormalizeOutputs(const UniValue& outputs_in)
|
||||
{
|
||||
if (outputs_in.isNull()) {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, output argument must be non-null");
|
||||
|
@ -94,6 +94,13 @@ void AddOutputs(CMutableTransaction& rawTx, const UniValue& outputs_in)
|
|||
}
|
||||
outputs = std::move(outputs_dict);
|
||||
}
|
||||
return outputs;
|
||||
}
|
||||
|
||||
void AddOutputs(CMutableTransaction& rawTx, const UniValue& outputs_in)
|
||||
{
|
||||
UniValue outputs(UniValue::VOBJ);
|
||||
outputs = NormalizeOutputs(outputs_in);
|
||||
|
||||
// Duplicate checking
|
||||
std::set<CTxDestination> destinations;
|
||||
|
|
|
@ -42,7 +42,10 @@ void ParsePrevouts(const UniValue& prevTxsUnival, FillableSigningProvider* keyst
|
|||
/** Normalize univalue-represented inputs and add them to the transaction */
|
||||
void AddInputs(CMutableTransaction& rawTx, const UniValue& inputs_in, bool rbf);
|
||||
|
||||
/** Normalize univalue-represented outputs and add them to the transaction */
|
||||
/** Normalize univalue-represented outputs */
|
||||
UniValue NormalizeOutputs(const UniValue& outputs_in);
|
||||
|
||||
/** Normalize, parse, and add outputs to the transaction */
|
||||
void AddOutputs(CMutableTransaction& rawTx, const UniValue& outputs_in);
|
||||
|
||||
/** Create a transaction from univalue parameters */
|
||||
|
|
Loading…
Add table
Reference in a new issue