Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

sign.cpp File Reference
#include <script/sign.h>
#include <key.h>
#include <keystore.h>
#include <policy/policy.h>
#include <primitives/transaction.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< unsigned char > valtype
 

Functions

static bool Sign1 (const CKeyID &address, const BaseSignatureCreator &creator, const CScript &scriptCode, std::vector< valtype > &ret, SigVersion sigversion)
 
static bool SignN (const std::vector< valtype > &multisigdata, const BaseSignatureCreator &creator, const CScript &scriptCode, std::vector< valtype > &ret, SigVersion sigversion)
 
static bool SignStep (const BaseSignatureCreator &creator, const CScript &scriptPubKey, std::vector< valtype > &ret, txnouttype &whichTypeRet, SigVersion sigversion)
 Sign scriptPubKey using signature made with creator. More...
 
static CScript PushAll (const std::vector< valtype > &values)
 
bool ProduceSignature (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)
 Extract signature data from a transaction, and insert it. More...
 
void UpdateTransaction (CMutableTransaction &tx, unsigned int nIn, const SignatureData &data)
 
bool SignSignature (const CKeyStore &keystore, const CScript &fromPubKey, CMutableTransaction &txTo, unsigned int nIn, const CAmount &amount, int nHashType)
 Produce a script signature for a transaction. More...
 
bool SignSignature (const CKeyStore &keystore, const CTransaction &txFrom, CMutableTransaction &txTo, unsigned int nIn, int nHashType)
 
static std::vector< valtypeCombineMultisig (const CScript &scriptPubKey, const BaseSignatureChecker &checker, const std::vector< valtype > &vSolutions, const std::vector< valtype > &sigs1, const std::vector< valtype > &sigs2, SigVersion sigversion)
 
static Stacks CombineSignatures (const CScript &scriptPubKey, const BaseSignatureChecker &checker, const txnouttype txType, const std::vector< valtype > &vSolutions, Stacks sigs1, Stacks sigs2, SigVersion sigversion)
 
SignatureData CombineSignatures (const CScript &scriptPubKey, const BaseSignatureChecker &checker, const SignatureData &scriptSig1, const SignatureData &scriptSig2)
 Combine two script signatures using a generic signature checker, intelligently, possibly with OP_0 placeholders. More...
 

Typedef Documentation

◆ valtype

typedef std::vector<unsigned char> valtype

Definition at line 16 of file sign.cpp.

Function Documentation

◆ CombineMultisig()

static std::vector<valtype> CombineMultisig ( const CScript scriptPubKey,
const BaseSignatureChecker checker,
const std::vector< valtype > &  vSolutions,
const std::vector< valtype > &  sigs1,
const std::vector< valtype > &  sigs2,
SigVersion  sigversion 
)
static

Definition at line 190 of file sign.cpp.

References BaseSignatureChecker::CheckSig().

Referenced by CombineSignatures().

◆ CombineSignatures() [1/2]

static Stacks CombineSignatures ( const CScript scriptPubKey,
const BaseSignatureChecker checker,
const txnouttype  txType,
const std::vector< valtype > &  vSolutions,
Stacks  sigs1,
Stacks  sigs2,
SigVersion  sigversion 
)
static

◆ CombineSignatures() [2/2]

SignatureData CombineSignatures ( const CScript scriptPubKey,
const BaseSignatureChecker checker,
const SignatureData scriptSig1,
const SignatureData scriptSig2 
)

Combine two script signatures using a generic signature checker, intelligently, possibly with OP_0 placeholders.

Definition at line 310 of file sign.cpp.

References CombineSignatures(), SIGVERSION_BASE, and Solver().

◆ DataFromTransaction()

SignatureData DataFromTransaction ( const CMutableTransaction tx,
unsigned int  nIn 
)

Extract signature data from a transaction, and insert it.

Definition at line 153 of file sign.cpp.

References SignatureData::scriptSig, and CMutableTransaction::vin.

Referenced by combinerawtransaction(), MutateTxSign(), and signrawtransaction().

◆ ProduceSignature()

◆ PushAll()

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

Definition at line 109 of file sign.cpp.

References CScript::EncodeOP_N(), and OP_0.

Referenced by ProduceSignature().

◆ Sign1()

static bool Sign1 ( const CKeyID address,
const BaseSignatureCreator creator,
const CScript scriptCode,
std::vector< valtype > &  ret,
SigVersion  sigversion 
)
static

Definition at line 33 of file sign.cpp.

References BaseSignatureCreator::CreateSig().

Referenced by SignN(), and SignStep().

◆ SignN()

static bool SignN ( const std::vector< valtype > &  multisigdata,
const BaseSignatureCreator creator,
const CScript scriptCode,
std::vector< valtype > &  ret,
SigVersion  sigversion 
)
static

Definition at line 42 of file sign.cpp.

References CPubKey::GetID(), and Sign1().

Referenced by SignStep().

◆ SignSignature() [1/2]

bool SignSignature ( const CKeyStore keystore,
const CScript fromPubKey,
CMutableTransaction txTo,
unsigned int  nIn,
const CAmount amount,
int  nHashType 
)

Produce a script signature for a transaction.

Definition at line 167 of file sign.cpp.

References ProduceSignature(), UpdateTransaction(), and CMutableTransaction::vin.

Referenced by CWallet::CreateCollateralTransaction(), CPrivateSendClientSession::SignFinalTransaction(), and SignSignature().

◆ SignSignature() [2/2]

bool SignSignature ( const CKeyStore keystore,
const CTransaction txFrom,
CMutableTransaction txTo,
unsigned int  nIn,
int  nHashType 
)

Definition at line 180 of file sign.cpp.

References SignSignature(), CMutableTransaction::vin, and CTransaction::vout.

◆ SignStep()

static bool SignStep ( const BaseSignatureCreator creator,
const CScript scriptPubKey,
std::vector< valtype > &  ret,
txnouttype whichTypeRet,
SigVersion  sigversion 
)
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 TX_SCRIPTHASH, in which case scriptSigRet is the redemption script. Returns false if scriptPubKey could not be completely satisfied.

Definition at line 62 of file sign.cpp.

References prevector< N, T, Size, Diff >::begin(), prevector< N, T, Size, Diff >::end(), CKeyStore::GetCScript(), CPubKey::GetID(), CKeyStore::GetPubKey(), BaseSignatureCreator::KeyStore(), Sign1(), SignN(), Solver(), ToByteVector(), TX_MULTISIG, TX_NONSTANDARD, TX_NULL_DATA, TX_PUBKEY, TX_PUBKEYHASH, and TX_SCRIPTHASH.

Referenced by ProduceSignature().

◆ UpdateTransaction()

void UpdateTransaction ( CMutableTransaction tx,
unsigned int  nIn,
const SignatureData data 
)
Released under the MIT license