Bitcoin Core 31.0.0
P2P Digital Currency
Loading...
Searching...
No Matches
core_io.cpp File Reference
#include <core_io.h>
#include <addresstype.h>
#include <coins.h>
#include <consensus/amount.h>
#include <consensus/consensus.h>
#include <consensus/validation.h>
#include <crypto/hex_base.h>
#include <key_io.h>
#include <primitives/block.h>
#include <primitives/transaction.h>
#include <script/descriptor.h>
#include <script/interpreter.h>
#include <script/script.h>
#include <script/signingprovider.h>
#include <script/solver.h>
#include <serialize.h>
#include <streams.h>
#include <tinyformat.h>
#include <uint256.h>
#include <undo.h>
#include <univalue.h>
#include <util/check.h>
#include <util/result.h>
#include <util/strencodings.h>
#include <util/string.h>
#include <util/translation.h>
#include <algorithm>
#include <compare>
#include <cstdint>
#include <exception>
#include <functional>
#include <map>
#include <memory>
#include <optional>
#include <span>
#include <stdexcept>
#include <string>
#include <utility>
#include <vector>
Include dependency graph for core_io.cpp:

Go to the source code of this file.

Functions

CScript ParseScript (const std::string &s)
static bool CheckTxScriptsSanity (const CMutableTransaction &tx)
 Check that all of the input and output scripts of a transaction contain valid opcodes.
static bool DecodeTx (CMutableTransaction &tx, const std::vector< unsigned char > &tx_data, bool try_no_witness, bool try_witness)
bool DecodeHexTx (CMutableTransaction &tx, const std::string &hex_tx, bool try_no_witness, bool try_witness)
bool DecodeHexBlockHeader (CBlockHeader &header, const std::string &hex_header)
bool DecodeHexBlk (CBlock &block, const std::string &strHexBlk)
util::Result< int > SighashFromStr (const std::string &sighash)
UniValue ValueFromAmount (const CAmount amount)
std::string FormatScript (const CScript &script)
std::string SighashToStr (unsigned char sighash_type)
std::string ScriptToAsmStr (const CScript &script, const bool fAttemptSighashDecode)
 Create the assembly string representation of a CScript object.
std::string EncodeHexTx (const CTransaction &tx)
void ScriptToUniv (const CScript &script, UniValue &out, bool include_hex, bool include_address, const SigningProvider *provider)
void TxToUniv (const CTransaction &tx, const uint256 &block_hash, UniValue &entry, bool include_hex, const CTxUndo *txundo, TxVerbosity verbosity, std::function< bool(const CTxOut &)> is_change_func)
std::vector< std::string > SplitString (std::string_view str, char sep)

Variables

const std::map< unsigned char, std::string > mapSigHashTypes

Function Documentation

◆ CheckTxScriptsSanity()

bool CheckTxScriptsSanity ( const CMutableTransaction & tx)
static

Check that all of the input and output scripts of a transaction contain valid opcodes.

Definition at line 136 of file core_io.cpp.

Here is the caller graph for this function:

◆ DecodeHexBlk()

bool DecodeHexBlk ( CBlock & block,
const std::string & strHexBlk )
nodiscard

Definition at line 250 of file core_io.cpp.

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

◆ DecodeHexBlockHeader()

bool DecodeHexBlockHeader ( CBlockHeader & header,
const std::string & hex_header )

Definition at line 237 of file core_io.cpp.

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

◆ DecodeHexTx()

bool DecodeHexTx ( CMutableTransaction & tx,
const std::string & hex_tx,
bool try_no_witness,
bool try_witness )
nodiscard

Definition at line 227 of file core_io.cpp.

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

◆ DecodeTx()

bool DecodeTx ( CMutableTransaction & tx,
const std::vector< unsigned char > & tx_data,
bool try_no_witness,
bool try_witness )
static

Definition at line 156 of file core_io.cpp.

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

◆ EncodeHexTx()

std::string EncodeHexTx ( const CTransaction & tx)

Definition at line 402 of file core_io.cpp.

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

◆ FormatScript()

std::string FormatScript ( const CScript & script)

Definition at line 298 of file core_io.cpp.

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

◆ ParseScript()

CScript ParseScript ( const std::string & s)

Definition at line 94 of file core_io.cpp.

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

◆ ScriptToAsmStr()

std::string ScriptToAsmStr ( const CScript & script,
const bool fAttemptSighashDecode )

Create the assembly string representation of a CScript object.

Parameters
[in]scriptCScript object to convert into the asm string representation.
[in]fAttemptSighashDecodeWhether to attempt to decode sighash types on data within the script that matches the format of a signature. Only pass true for scripts you believe could contain signatures. For example, pass false, or omit the this argument (defaults to false), for scriptPubKeys.

Definition at line 357 of file core_io.cpp.

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

◆ ScriptToUniv()

void ScriptToUniv ( const CScript & script,
UniValue & out,
bool include_hex,
bool include_address,
const SigningProvider * provider )

Definition at line 409 of file core_io.cpp.

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

◆ SighashFromStr()

util::Result< int > SighashFromStr ( const std::string & sighash)
nodiscard

Definition at line 266 of file core_io.cpp.

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

◆ SighashToStr()

std::string SighashToStr ( unsigned char sighash_type)

Definition at line 343 of file core_io.cpp.

Here is the caller graph for this function:

◆ SplitString()

std::vector< std::string > util::SplitString ( std::string_view str,
char sep )
inlinenodiscard

Definition at line 149 of file string.h.

Here is the caller graph for this function:

◆ TxToUniv()

void TxToUniv ( const CTransaction & tx,
const uint256 & block_hash,
UniValue & entry,
bool include_hex,
const CTxUndo * txundo,
TxVerbosity verbosity,
std::function< bool(const CTxOut &)> is_change_func )

Definition at line 430 of file core_io.cpp.

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

◆ ValueFromAmount()

UniValue ValueFromAmount ( const CAmount amount)

Definition at line 285 of file core_io.cpp.

Here is the caller graph for this function:

Variable Documentation

◆ mapSigHashTypes

const std::map<unsigned char, std::string> mapSigHashTypes
Initial value:
= {
{static_cast<unsigned char>(SIGHASH_ALL), std::string("ALL")},
{static_cast<unsigned char>(SIGHASH_ALL|SIGHASH_ANYONECANPAY), std::string("ALL|ANYONECANPAY")},
{static_cast<unsigned char>(SIGHASH_NONE), std::string("NONE")},
{static_cast<unsigned char>(SIGHASH_NONE|SIGHASH_ANYONECANPAY), std::string("NONE|ANYONECANPAY")},
{static_cast<unsigned char>(SIGHASH_SINGLE), std::string("SINGLE")},
{static_cast<unsigned char>(SIGHASH_SINGLE|SIGHASH_ANYONECANPAY), std::string("SINGLE|ANYONECANPAY")},
}
@ SIGHASH_ANYONECANPAY
Definition interpreter.h:34
@ SIGHASH_ALL
Definition interpreter.h:31
@ SIGHASH_NONE
Definition interpreter.h:32
@ SIGHASH_SINGLE
Definition interpreter.h:33

Definition at line 334 of file core_io.cpp.