Bitcoin ABC 0.34.2
P2P Digital Currency
Classes | Typedefs | Functions
addresstype.h File Reference
#include <pubkey.h>
#include <script/script.h>
#include <uint256.h>
#include <util/hash_type.h>
#include <variant>
Include dependency graph for addresstype.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  CNoDestination
 
struct  PKHash
 
struct  ScriptHash
 

Typedefs

using CTxDestination = std::variant< CNoDestination, PKHash, ScriptHash >
 A txout script template with a specific destination. More...
 

Functions

CKeyID ToKeyID (const PKHash &key_hash)
 
CScriptID ToScriptID (const ScriptHash &script_hash)
 
bool IsValidDestination (const CTxDestination &dest)
 Check whether a CTxDestination is a CNoDestination. More...
 
bool ExtractDestination (const CScript &scriptPubKey, CTxDestination &addressRet)
 Parse a standard scriptPubKey for the destination address. More...
 
bool ExtractDestinations (const CScript &scriptPubKey, TxoutType &typeRet, std::vector< CTxDestination > &addressRet, int &nRequiredRet)
 Parse a standard scriptPubKey with one or more destination addresses. More...
 
CScript GetScriptForDestination (const CTxDestination &dest)
 Generate a Bitcoin scriptPubKey for the given CTxDestination. More...
 

Typedef Documentation

◆ CTxDestination

A txout script template with a specific destination.

It is either:

Definition at line 54 of file addresstype.h.

Function Documentation

◆ ExtractDestination()

bool ExtractDestination ( const CScript &  scriptPubKey,
CTxDestination &  addressRet 
)

Parse a standard scriptPubKey for the destination address.

Assigns result to the addressRet parameter and returns true if successful. For multisig scripts, instead use ExtractDestinations. Currently only works for P2PK, P2PKH, and P2SH scripts.

Definition at line 33 of file addresstype.cpp.

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

◆ ExtractDestinations()

bool ExtractDestinations ( const CScript &  scriptPubKey,
TxoutType &  typeRet,
std::vector< CTxDestination > &  addressRet,
int &  nRequiredRet 
)

Parse a standard scriptPubKey with one or more destination addresses.

For multisig scripts, this populates the addressRet vector with the pubkey IDs and nRequiredRet with the n required to spend. For other destinations, addressRet is populated with a single value and nRequiredRet is set to 1. Returns true if successful.

Note: this function confuses destinations (a subset of CScripts that are encodable as an address) with key identifiers (of keys involved in a CScript), and its use should be phased out.

Definition at line 59 of file addresstype.cpp.

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

◆ GetScriptForDestination()

CScript GetScriptForDestination ( const CTxDestination &  dest)

Generate a Bitcoin scriptPubKey for the given CTxDestination.

Returns a P2PKH script for a CKeyID destination, a P2SH script for a CScriptID, and an empty script for CNoDestination.

Definition at line 115 of file addresstype.cpp.

Here is the caller graph for this function:

◆ IsValidDestination()

bool IsValidDestination ( const CTxDestination &  dest)

Check whether a CTxDestination is a CNoDestination.

Definition at line 119 of file addresstype.cpp.

Here is the caller graph for this function:

◆ ToKeyID()

CKeyID ToKeyID ( const PKHash &  key_hash)

Definition at line 29 of file addresstype.cpp.

Here is the caller graph for this function:

◆ ToScriptID()

CScriptID ToScriptID ( const ScriptHash &  script_hash)

Definition at line 22 of file addresstype.cpp.

Here is the caller graph for this function: