Bitshares-Core  2.0.181105
BitShares blockchain implementation and command-line interface software
Public Member Functions | Public Attributes | List of all members
graphene::chain::signed_transaction Struct Reference

adds a signature to a transaction More...

#include <transaction.hpp>

Inheritance diagram for graphene::chain::signed_transaction:
graphene::chain::transaction graphene::chain::processed_transaction

Public Member Functions

 signed_transaction (const transaction &trx=transaction())
 
const signature_typesign (const private_key_type &key, const chain_id_type &chain_id)
 
signature_type sign (const private_key_type &key, const chain_id_type &chain_id) const
 
set< public_key_typeget_required_signatures (const chain_id_type &chain_id, const flat_set< public_key_type > &available_keys, const std::function< const authority *(account_id_type)> &get_active, const std::function< const authority *(account_id_type)> &get_owner, uint32_t max_recursion=GRAPHENE_MAX_SIG_CHECK_DEPTH) const
 
void verify_authority (const chain_id_type &chain_id, const std::function< const authority *(account_id_type)> &get_active, const std::function< const authority *(account_id_type)> &get_owner, uint32_t max_recursion=GRAPHENE_MAX_SIG_CHECK_DEPTH) const
 
set< public_key_typeminimize_required_signatures (const chain_id_type &chain_id, const flat_set< public_key_type > &available_keys, const std::function< const authority *(account_id_type)> &get_active, const std::function< const authority *(account_id_type)> &get_owner, uint32_t max_recursion=GRAPHENE_MAX_SIG_CHECK_DEPTH) const
 
const flat_set< public_key_type > & get_signature_keys (const chain_id_type &chain_id) const
 Extract public keys from signatures with given chain ID. More...
 
void clear ()
 Removes all operations, signatures and signees. More...
 
void clear_signatures ()
 Removes all signatures and signees. More...
 
- Public Member Functions inherited from graphene::chain::transaction
digest_type digest () const
 Calculate the digest for a transaction. More...
 
transaction_id_type id () const
 
void validate () const
 
digest_type sig_digest (const chain_id_type &chain_id) const
 Calculate the digest used for signature validation. More...
 
void set_expiration (fc::time_point_sec expiration_time)
 
void set_reference_block (const block_id_type &reference_block)
 
template<typename Visitor >
vector< typename Visitor::result_type > visit (Visitor &&visitor)
 visit all operations More...
 
template<typename Visitor >
vector< typename Visitor::result_type > visit (Visitor &&visitor) const
 
void get_required_authorities (flat_set< account_id_type > &active, flat_set< account_id_type > &owner, vector< authority > &other) const
 

Public Attributes

vector< signature_typesignatures
 
flat_set< public_key_typesignees
 
- Public Attributes inherited from graphene::chain::transaction
uint16_t ref_block_num = 0
 
uint32_t ref_block_prefix = 0
 
fc::time_point_sec expiration
 
vector< operationoperations
 
extensions_type extensions
 

Detailed Description

adds a signature to a transaction

Definition at line 121 of file transaction.hpp.

Constructor & Destructor Documentation

◆ signed_transaction()

graphene::chain::signed_transaction::signed_transaction ( const transaction trx = transaction())
inline

Definition at line 123 of file transaction.hpp.

Member Function Documentation

◆ clear()

void graphene::chain::signed_transaction::clear ( )
inline

Removes all operations, signatures and signees.

Definition at line 188 of file transaction.hpp.

◆ clear_signatures()

void graphene::chain::signed_transaction::clear_signatures ( )
inline

Removes all signatures and signees.

Definition at line 191 of file transaction.hpp.

◆ get_required_signatures()

set< public_key_type > graphene::chain::signed_transaction::get_required_signatures ( const chain_id_type chain_id,
const flat_set< public_key_type > &  available_keys,
const std::function< const authority *(account_id_type)> &  get_active,
const std::function< const authority *(account_id_type)> &  get_owner,
uint32_t  max_recursion = GRAPHENE_MAX_SIG_CHECK_DEPTH 
) const

The purpose of this method is to identify some subset of available_keys that will produce sufficient signatures for a transaction. The result is not always a minimal set of signatures, but any non-minimal result will still pass validation.

Definition at line 327 of file transaction.cpp.

◆ get_signature_keys()

const flat_set< public_key_type > & graphene::chain::signed_transaction::get_signature_keys ( const chain_id_type chain_id) const

Extract public keys from signatures with given chain ID.

Parameters
chain_idA chain ID
Returns
Public keys
Note
If signees is empty, E.G. when it's the first time calling this function for the signed transaction, public keys will be extracted with given chain ID, and be stored into the mutable signees field, then signees will be returned; otherwise, the chain_id parameter will be ignored, and signees will be returned directly.

Definition at line 306 of file transaction.cpp.

◆ minimize_required_signatures()

set< public_key_type > graphene::chain::signed_transaction::minimize_required_signatures ( const chain_id_type chain_id,
const flat_set< public_key_type > &  available_keys,
const std::function< const authority *(account_id_type)> &  get_active,
const std::function< const authority *(account_id_type)> &  get_owner,
uint32_t  max_recursion = GRAPHENE_MAX_SIG_CHECK_DEPTH 
) const

This is a slower replacement for get_required_signatures() which returns a minimal set in all cases, including some cases where get_required_signatures() returns a non-minimal set.

Definition at line 362 of file transaction.cpp.

◆ sign() [1/2]

const signature_type & graphene::chain::signed_transaction::sign ( const private_key_type key,
const chain_id_type chain_id 
)

signs and appends to signatures

Definition at line 71 of file transaction.cpp.

◆ sign() [2/2]

signature_type graphene::chain::signed_transaction::sign ( const private_key_type key,
const chain_id_type chain_id 
) const

returns signature but does not append

Definition at line 79 of file transaction.cpp.

◆ verify_authority()

void graphene::chain::signed_transaction::verify_authority ( const chain_id_type chain_id,
const std::function< const authority *(account_id_type)> &  get_active,
const std::function< const authority *(account_id_type)> &  get_owner,
uint32_t  max_recursion = GRAPHENE_MAX_SIG_CHECK_DEPTH 
) const

Definition at line 389 of file transaction.cpp.

Member Data Documentation

◆ signatures

vector<signature_type> graphene::chain::signed_transaction::signatures

Signatures

Definition at line 182 of file transaction.hpp.

◆ signees

flat_set<public_key_type> graphene::chain::signed_transaction::signees
mutable

Public keys extracted from signatures

Definition at line 185 of file transaction.hpp.


The documentation for this struct was generated from the following files: