Bitcoin Core 29.99.0
P2P Digital Currency
Functions
rawtransaction_util.cpp File Reference
#include <rpc/rawtransaction_util.h>
#include <coins.h>
#include <consensus/amount.h>
#include <core_io.h>
#include <key_io.h>
#include <policy/policy.h>
#include <primitives/transaction.h>
#include <rpc/request.h>
#include <rpc/util.h>
#include <script/sign.h>
#include <script/signingprovider.h>
#include <tinyformat.h>
#include <univalue.h>
#include <util/rbf.h>
#include <util/string.h>
#include <util/strencodings.h>
#include <util/translation.h>
Include dependency graph for rawtransaction_util.cpp:

Go to the source code of this file.

Functions

void AddInputs (CMutableTransaction &rawTx, const UniValue &inputs_in, std::optional< bool > rbf)
 
UniValue NormalizeOutputs (const UniValue &outputs_in)
 Normalize univalue-represented outputs. More...
 
std::vector< std::pair< CTxDestination, CAmount > > ParseOutputs (const UniValue &outputs)
 Parse normalized outputs into destination, amount tuples. More...
 
void AddOutputs (CMutableTransaction &rawTx, const UniValue &outputs_in)
 Normalize, parse, and add outputs to the transaction. More...
 
CMutableTransaction ConstructTransaction (const UniValue &inputs_in, const UniValue &outputs_in, const UniValue &locktime, std::optional< bool > rbf, const uint32_t version)
 Create a transaction from univalue parameters. More...
 
static void TxInErrorToJSON (const CTxIn &txin, UniValue &vErrorsRet, const std::string &strMessage)
 Pushes a JSON object for script verification or signing errors to vErrorsRet. More...
 
void ParsePrevouts (const UniValue &prevTxsUnival, FlatSigningProvider *keystore, std::map< COutPoint, Coin > &coins)
 Parse a prevtxs UniValue array and get the map of coins from it. More...
 
void SignTransaction (CMutableTransaction &mtx, const SigningProvider *keystore, const std::map< COutPoint, Coin > &coins, const UniValue &hashType, UniValue &result)
 Sign a transaction with the given keystore and previous transactions. More...
 
void SignTransactionResultToJSON (CMutableTransaction &mtx, bool complete, const std::map< COutPoint, Coin > &coins, const std::map< int, bilingual_str > &input_errors, UniValue &result)
 

Function Documentation

◆ AddInputs()

void AddInputs ( CMutableTransaction rawTx,
const UniValue inputs_in,
std::optional< bool >  rbf 
)

Definition at line 25 of file rawtransaction_util.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddOutputs()

void AddOutputs ( CMutableTransaction rawTx,
const UniValue outputs_in 
)

Normalize, parse, and add outputs to the transaction.

Definition at line 133 of file rawtransaction_util.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ConstructTransaction()

CMutableTransaction ConstructTransaction ( const UniValue inputs_in,
const UniValue outputs_in,
const UniValue locktime,
std::optional< bool >  rbf,
const uint32_t  version 
)

Create a transaction from univalue parameters.

Definition at line 147 of file rawtransaction_util.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ NormalizeOutputs()

UniValue NormalizeOutputs ( const UniValue outputs_in)

Normalize univalue-represented outputs.

Definition at line 74 of file rawtransaction_util.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ParseOutputs()

std::vector< std::pair< CTxDestination, CAmount > > ParseOutputs ( const UniValue outputs)

Parse normalized outputs into destination, amount tuples.

Definition at line 101 of file rawtransaction_util.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ParsePrevouts()

void ParsePrevouts ( const UniValue prevTxsUnival,
FlatSigningProvider keystore,
std::map< COutPoint, Coin > &  coins 
)

Parse a prevtxs UniValue array and get the map of coins from it.

Parameters
prevTxsUnivalArray of previous txns outputs that tx depends on but may not yet be in the block chain
keystoreA pointer to the temporary keystore if there is one
coinsMap of unspent outputs - coins in mempool and current chain UTXO set, may be extended by previous txns outputs after call

Definition at line 190 of file rawtransaction_util.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SignTransaction()

void SignTransaction ( CMutableTransaction mtx,
const SigningProvider keystore,
const std::map< COutPoint, Coin > &  coins,
const UniValue hashType,
UniValue result 
)

Sign a transaction with the given keystore and previous transactions.

Parameters
mtxThe transaction to-be-signed
keystoreTemporary keystore containing signing keys
coinsMap of unspent outputs
hashTypeThe signature hash type
resultJSON object where signed transaction results accumulate

Definition at line 311 of file rawtransaction_util.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SignTransactionResultToJSON()

void SignTransactionResultToJSON ( CMutableTransaction mtx,
bool  complete,
const std::map< COutPoint, Coin > &  coins,
const std::map< int, bilingual_str > &  input_errors,
UniValue result 
)

Definition at line 325 of file rawtransaction_util.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TxInErrorToJSON()

static void TxInErrorToJSON ( const CTxIn txin,
UniValue vErrorsRet,
const std::string &  strMessage 
)
static

Pushes a JSON object for script verification or signing errors to vErrorsRet.

Definition at line 174 of file rawtransaction_util.cpp.

Here is the call graph for this function:
Here is the caller graph for this function: