Bitcoin ABC  0.24.7
P2P Digital Currency
Typedefs | Functions | Variables
sign.cpp File Reference
#include <script/sign.h>
#include <key.h>
#include <policy/policy.h>
#include <primitives/transaction.h>
#include <script/signingprovider.h>
#include <script/standard.h>
#include <uint256.h>
Include dependency graph for sign.cpp:

Go to the source code of this file.

Typedefs

typedef std::vector< uint8_t > valtype
 

Functions

static bool GetCScript (const SigningProvider &provider, const SignatureData &sigdata, const CScriptID &scriptid, CScript &script)
 
static bool GetPubKey (const SigningProvider &provider, const SignatureData &sigdata, const CKeyID &address, CPubKey &pubkey)
 
static bool CreateSig (const BaseSignatureCreator &creator, SignatureData &sigdata, const SigningProvider &provider, std::vector< uint8_t > &sig_out, const CPubKey &pubkey, const CScript &scriptcode)
 
static bool SignStep (const SigningProvider &provider, const BaseSignatureCreator &creator, const CScript &scriptPubKey, std::vector< valtype > &ret, TxoutType &whichTypeRet, SignatureData &sigdata)
 Sign scriptPubKey using signature made with creator. More...
 
static CScript PushAll (const std::vector< valtype > &values)
 
bool ProduceSignature (const SigningProvider &provider, const BaseSignatureCreator &creator, const CScript &fromPubKey, SignatureData &sigdata)
 Produce a script signature using a generic signature creator. More...
 
SignatureData DataFromTransaction (const CMutableTransaction &tx, unsigned int nIn, const CTxOut &txout)
 Extract signature data from a transaction input, and insert it. More...
 
void UpdateInput (CTxIn &input, const SignatureData &data)
 
bool SignSignature (const SigningProvider &provider, const CScript &fromPubKey, CMutableTransaction &txTo, unsigned int nIn, const Amount amount, SigHashType sigHashType)
 Produce a script signature for a transaction. More...
 
bool SignSignature (const SigningProvider &provider, const CTransaction &txFrom, CMutableTransaction &txTo, unsigned int nIn, SigHashType sigHashType)
 
bool IsSolvable (const SigningProvider &provider, const CScript &script)
 Check whether we know how to sign for an output like this, assuming we have all private keys. More...
 
bool SignTransaction (CMutableTransaction &mtx, const SigningProvider *keystore, const std::map< COutPoint, Coin > &coins, SigHashType sigHashType, std::map< int, std::string > &input_errors)
 Sign the CMutableTransaction. More...
 

Variables

const BaseSignatureCreatorDUMMY_SIGNATURE_CREATOR
 A signature creator that just produces 71-byte empty signatures. More...
 
const BaseSignatureCreatorDUMMY_MAXIMUM_SIGNATURE_CREATOR
 A signature creator that just produces 72-byte empty signatures. More...
 

Typedef Documentation

◆ valtype

typedef std::vector<uint8_t> valtype

Definition at line 15 of file sign.cpp.

Function Documentation

◆ CreateSig()

static bool CreateSig ( const BaseSignatureCreator creator,
SignatureData sigdata,
const SigningProvider provider,
std::vector< uint8_t > &  sig_out,
const CPubKey pubkey,
const CScript scriptcode 
)
static

Definition at line 73 of file sign.cpp.

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

◆ DataFromTransaction()

SignatureData DataFromTransaction ( const CMutableTransaction tx,
unsigned int  nIn,
const CTxOut txout 
)

Extract signature data from a transaction input, and insert it.

Definition at line 274 of file sign.cpp.

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

◆ GetCScript()

static bool GetCScript ( const SigningProvider provider,
const SignatureData sigdata,
const CScriptID scriptid,
CScript script 
)
static

Definition at line 40 of file sign.cpp.

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

◆ GetPubKey()

static bool GetPubKey ( const SigningProvider provider,
const SignatureData sigdata,
const CKeyID address,
CPubKey pubkey 
)
static

Definition at line 54 of file sign.cpp.

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

◆ IsSolvable()

bool IsSolvable ( const SigningProvider provider,
const CScript script 
)

Check whether we know how to sign for an output like this, assuming we have all private keys.

While this function does not need private keys, the passed keystore is used to look up public keys and redeemscripts by hash. Solvability is unrelated to whether we consider this output to be ours.

Definition at line 423 of file sign.cpp.

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

◆ ProduceSignature()

bool ProduceSignature ( const SigningProvider provider,
const BaseSignatureCreator creator,
const CScript fromPubKey,
SignatureData sigdata 
)

Produce a script signature using a generic signature creator.

Definition at line 197 of file sign.cpp.

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

◆ PushAll()

static CScript PushAll ( const std::vector< valtype > &  values)
static

Definition at line 182 of file sign.cpp.

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

◆ SignSignature() [1/2]

bool SignSignature ( const SigningProvider provider,
const CScript fromPubKey,
CMutableTransaction txTo,
unsigned int  nIn,
const Amount  amount,
SigHashType  sigHashType 
)

Produce a script signature for a transaction.

Definition at line 349 of file sign.cpp.

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

◆ SignSignature() [2/2]

bool SignSignature ( const SigningProvider provider,
const CTransaction txFrom,
CMutableTransaction txTo,
unsigned int  nIn,
SigHashType  sigHashType 
)

Definition at line 362 of file sign.cpp.

Here is the call graph for this function:

◆ SignStep()

static bool SignStep ( const SigningProvider provider,
const BaseSignatureCreator creator,
const CScript scriptPubKey,
std::vector< valtype > &  ret,
TxoutType whichTypeRet,
SignatureData sigdata 
)
static

Sign scriptPubKey using signature made with creator.

Signatures are returned in scriptSigRet (or returns false if scriptPubKey can't be signed), unless whichTypeRet is TxoutType::SCRIPTHASH, in which case scriptSigRet is the redemption script. Returns false if scriptPubKey could not be completely satisfied.

Definition at line 105 of file sign.cpp.

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

◆ SignTransaction()

bool SignTransaction ( CMutableTransaction mtx,
const SigningProvider keystore,
const std::map< COutPoint, Coin > &  coins,
SigHashType  sigHashType,
std::map< int, std::string > &  input_errors 
)

Sign the CMutableTransaction.

Definition at line 440 of file sign.cpp.

Here is the call graph for this function:

◆ UpdateInput()

void UpdateInput ( CTxIn input,
const SignatureData data 
)

Definition at line 330 of file sign.cpp.

Here is the caller graph for this function:

Variable Documentation

◆ DUMMY_MAXIMUM_SIGNATURE_CREATOR

const BaseSignatureCreator& DUMMY_MAXIMUM_SIGNATURE_CREATOR
Initial value:
=
DummySignatureCreator(33, 32)

A signature creator that just produces 72-byte empty signatures.

Definition at line 420 of file sign.cpp.

◆ DUMMY_SIGNATURE_CREATOR

const BaseSignatureCreator& DUMMY_SIGNATURE_CREATOR
Initial value:
=
DummySignatureCreator(32, 32)

A signature creator that just produces 71-byte empty signatures.

Definition at line 418 of file sign.cpp.