LCOV - code coverage report
Current view: top level - src/rpc - rawtransaction_util.h Coverage Total Hit
Test: test_bitcoin_coverage.info Lines: 100.0 % 1 1
Test Date: 2026-03-25 04:46:48 Functions: - 0 0

            Line data    Source code
       1              : // Copyright (c) 2017-present The Bitcoin Core developers
       2              : // Distributed under the MIT software license, see the accompanying
       3              : // file COPYING or http://www.opensource.org/licenses/mit-license.php.
       4              : 
       5              : #ifndef BITCOIN_RPC_RAWTRANSACTION_UTIL_H
       6              : #define BITCOIN_RPC_RAWTRANSACTION_UTIL_H
       7              : 
       8              : #include <addresstype.h>
       9              : #include <consensus/amount.h>
      10              : #include <rpc/util.h>
      11              : #include <map>
      12              : #include <string>
      13              : #include <optional>
      14              : 
      15              : struct bilingual_str;
      16              : struct FlatSigningProvider;
      17              : class UniValue;
      18              : struct CMutableTransaction;
      19              : class Coin;
      20              : class COutPoint;
      21              : class SigningProvider;
      22              : 
      23              : /**
      24              :  * Sign a transaction with the given keystore and previous transactions
      25              :  *
      26              :  * @param  mtx           The transaction to-be-signed
      27              :  * @param  keystore      Temporary keystore containing signing keys
      28              :  * @param  coins         Map of unspent outputs
      29              :  * @param  hashType      The signature hash type
      30              :  * @param result         JSON object where signed transaction results accumulate
      31              :  */
      32              : void SignTransaction(CMutableTransaction& mtx, const SigningProvider* keystore, const std::map<COutPoint, Coin>& coins, const UniValue& hashType, UniValue& result);
      33              : void SignTransactionResultToJSON(CMutableTransaction& mtx, bool complete, const std::map<COutPoint, Coin>& coins, const std::map<int, bilingual_str>& input_errors, UniValue& result);
      34              : 
      35              : /**
      36              :   * Parse a prevtxs UniValue array and get the map of coins from it
      37              :   *
      38              :   * @param  prevTxsUnival Array of previous txns outputs that tx depends on but may not yet be in the block chain
      39              :   * @param  keystore      A pointer to the temporary keystore if there is one
      40              :   * @param  coins         Map of unspent outputs - coins in mempool and current chain UTXO set, may be extended by previous txns outputs after call
      41              :   */
      42              : void ParsePrevouts(const UniValue& prevTxsUnival, FlatSigningProvider* keystore, std::map<COutPoint, Coin>& coins);
      43              : 
      44              : /** Normalize univalue-represented inputs and add them to the transaction */
      45              : void AddInputs(CMutableTransaction& rawTx, const UniValue& inputs_in, bool rbf);
      46              : 
      47              : /** Normalize univalue-represented outputs */
      48              : UniValue NormalizeOutputs(const UniValue& outputs_in);
      49              : 
      50              : /** Parse normalized outputs into destination, amount tuples */
      51              : std::vector<std::pair<CTxDestination, CAmount>> ParseOutputs(const UniValue& outputs);
      52              : 
      53              : /** Normalize, parse, and add outputs to the transaction */
      54              : void AddOutputs(CMutableTransaction& rawTx, const UniValue& outputs_in);
      55              : 
      56              : /** Create a transaction from univalue parameters */
      57              : CMutableTransaction ConstructTransaction(const UniValue& inputs_in, const UniValue& outputs_in, const UniValue& locktime, std::optional<bool> rbf, uint32_t version);
      58              : 
      59          290 : struct TxDocOptions {
      60              :     /// The description of the txid field
      61              :     std::string txid_field_doc{"The transaction id"};
      62              :     /// Include wallet-related fields (e.g. ischange on outputs)
      63              :     bool wallet{false};
      64              :     /// Treat this as an elided Result in the help
      65              :     std::optional<std::string> elision_description{};
      66              : };
      67              : /** Explain the UniValue "decoded" transaction object, may include extra fields if processed by wallet **/
      68              : std::vector<RPCResult> TxDoc(const TxDocOptions& opts = {});
      69              : 
      70              : #endif // BITCOIN_RPC_RAWTRANSACTION_UTIL_H
        

Generated by: LCOV version 2.0-1