BitShares-Core  5.0.0
BitShares blockchain implementation and command-line interface software
Public Member Functions | Public Attributes | Protected Attributes | List of all members
graphene::protocol::signed_transaction Class Reference

adds a signature to a transaction More...

#include <transaction.hpp>

Inheritance diagram for graphene::protocol::signed_transaction:
graphene::protocol::transaction graphene::protocol::precomputable_transaction graphene::protocol::processed_transaction

Public Member Functions

 signed_transaction (const transaction &trx=transaction())
 
virtual ~signed_transaction ()=default
 
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, bool allow_non_immediate_owner, bool ignore_custom_operation_required_authorities, 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, const custom_authority_lookup &get_custom, bool allow_non_immediate_owner, bool ignore_custom_operation_required_auths, 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, const custom_authority_lookup &get_custom, bool allow_non_immediate_owner, bool ignore_custom_operation_required_auths, uint32_t max_recursion=GRAPHENE_MAX_SIG_CHECK_DEPTH) const
 
virtual 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 ()
 
void clear_signatures ()
 
- Public Member Functions inherited from graphene::protocol::transaction
virtual ~transaction ()=default
 
digest_type digest () const
 Calculate the digest for a transaction. More...
 
virtual const transaction_id_typeid () const
 
virtual void validate () const
 
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, bool ignore_custom_operation_required_auths) const
 
virtual uint64_t get_packed_size () const
 

Public Attributes

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

Protected Attributes

flat_set< public_key_type_signees
 
- Protected Attributes inherited from graphene::protocol::transaction
transaction_id_type _tx_id_buffer
 

Additional Inherited Members

- Protected Member Functions inherited from graphene::protocol::transaction
digest_type sig_digest (const chain_id_type &chain_id) const
 

Detailed Description

adds a signature to a transaction

Definition at line 134 of file transaction.hpp.

Constructor & Destructor Documentation

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

Definition at line 137 of file transaction.hpp.

virtual graphene::protocol::signed_transaction::~signed_transaction ( )
virtualdefault

Member Function Documentation

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

Removes all operations and signatures

Definition at line 220 of file transaction.hpp.

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

Removes all signatures

Definition at line 223 of file transaction.hpp.

set< public_key_type > graphene::protocol::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,
bool  allow_non_immediate_owner,
bool  ignore_custom_operation_required_authorities,
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 366 of file transaction.cpp.

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

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.

Reimplemented in graphene::protocol::precomputable_transaction.

Definition at line 350 of file transaction.cpp.

set< public_key_type > graphene::protocol::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,
const custom_authority_lookup get_custom,
bool  allow_non_immediate_owner,
bool  ignore_custom_operation_required_auths,
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 401 of file transaction.cpp.

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

signs and appends to signatures

Definition at line 77 of file transaction.cpp.

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

returns signature but does not append

Definition at line 84 of file transaction.cpp.

void graphene::protocol::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,
const custom_authority_lookup get_custom,
bool  allow_non_immediate_owner,
bool  ignore_custom_operation_required_auths,
uint32_t  max_recursion = GRAPHENE_MAX_SIG_CHECK_DEPTH 
) const

Checks whether signatures in this signed transaction are sufficient to authorize the transaction. Throws an exception when failed.

Parameters
chain_idthe ID of a block chain
get_activecallback function to retrieve active authorities of a given account
get_ownercallback function to retrieve owner authorities of a given account
get_customcallback function to retrieve viable custom authorities for a given account and operation
allow_non_immediate_ownerwhether to allow owner authority of non-immediately required accounts to authorize operations in the transaction
ignore_custom_operation_required_authsSee issue #210; whether to ignore the required_auths field of custom_operation or not
max_recursionmaximum level of recursion when verifying, since an account can have another account in active authorities and/or owner authorities

Definition at line 464 of file transaction.cpp.

Member Data Documentation

flat_set<public_key_type> graphene::protocol::signed_transaction::_signees
mutableprotected

Public keys extracted from signatures

Definition at line 226 of file transaction.hpp.

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

Signatures

Definition at line 217 of file transaction.hpp.


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