Compare commits
2 commits
master
...
debug-tran
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dedd0db975 | ||
|
|
37270bfd14 |
1 changed files with 29 additions and 9 deletions
|
|
@ -28,6 +28,8 @@
|
|||
#include <algorithm>
|
||||
#include <fc/io/raw.hpp>
|
||||
|
||||
#include <boost/algorithm/hex.hpp>
|
||||
|
||||
namespace graphene { namespace chain {
|
||||
|
||||
digest_type processed_transaction::merkle_digest()const
|
||||
|
|
@ -56,7 +58,7 @@ void transaction::validate() const
|
|||
{
|
||||
FC_ASSERT( operations.size() > 0, "A transaction must have at least one operation", ("trx",*this) );
|
||||
for( const auto& op : operations )
|
||||
operation_validate(op);
|
||||
operation_validate(op);
|
||||
}
|
||||
|
||||
graphene::chain::transaction_id_type graphene::chain::transaction::id() const
|
||||
|
|
@ -69,8 +71,26 @@ graphene::chain::transaction_id_type graphene::chain::transaction::id() const
|
|||
|
||||
const signature_type& graphene::chain::signed_transaction::sign(const private_key_type& key, const chain_id_type& chain_id)
|
||||
{
|
||||
std::stringstream ss;
|
||||
fc::raw::pack(ss, *this, 1000);
|
||||
std::string tx_str = boost::algorithm::hex(ss.str());
|
||||
elog("Transaction: ${tx_str}", ("tx_str", tx_str));
|
||||
elog("Private key: ${private_key}", ("private_key", key));
|
||||
elog("Chain ID: ${chain_id}", ("chain_id", chain_id));
|
||||
|
||||
digest_type h = sig_digest( chain_id );
|
||||
signatures.push_back(key.sign_compact(h));
|
||||
elog("Digest: ${h}", ("h", h));
|
||||
|
||||
signature_type s = key.sign_compact(h);
|
||||
elog("Signature: ${s}", ("s", s));
|
||||
|
||||
signatures.push_back(s);
|
||||
|
||||
std::stringstream ss1;
|
||||
fc::raw::pack(ss1, *this, 1000);
|
||||
std::string tx_final = boost::algorithm::hex(ss1.str());
|
||||
elog("Final: ${tx_final}", ("tx_final", tx_final));
|
||||
|
||||
signees.clear(); // Clear signees since it may be inconsistent after added a new signature
|
||||
return signatures.back();
|
||||
}
|
||||
|
|
@ -109,8 +129,8 @@ const flat_set<public_key_type> empty_keyset;
|
|||
|
||||
struct sign_state
|
||||
{
|
||||
/** returns true if we have a signature for this key or can
|
||||
* produce a signature for this key, else returns false.
|
||||
/** returns true if we have a signature for this key or can
|
||||
* produce a signature for this key, else returns false.
|
||||
*/
|
||||
bool signed_by( const public_key_type& k )
|
||||
{
|
||||
|
|
@ -169,7 +189,7 @@ struct sign_state
|
|||
|
||||
/**
|
||||
* Checks to see if we have signatures of the active authorites of
|
||||
* the accounts specified in authority or the keys specified.
|
||||
* the accounts specified in authority or the keys specified.
|
||||
*/
|
||||
bool check_authority( const authority* au, uint32_t depth = 0 )
|
||||
{
|
||||
|
|
@ -248,7 +268,7 @@ struct sign_state
|
|||
};
|
||||
|
||||
|
||||
void verify_authority( const vector<operation>& ops, const flat_set<public_key_type>& sigs,
|
||||
void verify_authority( const vector<operation>& ops, const flat_set<public_key_type>& sigs,
|
||||
const std::function<const authority*(account_id_type)>& get_active,
|
||||
const std::function<const authority*(account_id_type)>& get_owner,
|
||||
const std::function<vector<authority>(account_id_type, const operation&)>& get_custom,
|
||||
|
|
@ -307,15 +327,15 @@ void verify_authority( const vector<operation>& ops, const flat_set<public_key_t
|
|||
// fetch all of the top level authorities
|
||||
for( auto id : required_active )
|
||||
{
|
||||
GRAPHENE_ASSERT( s.check_authority(id) ||
|
||||
s.check_authority(get_owner(id)),
|
||||
GRAPHENE_ASSERT( s.check_authority(id) ||
|
||||
s.check_authority(get_owner(id)),
|
||||
tx_missing_active_auth, "Missing Active Authority ${id}", ("id",id)("auth",*get_active(id))("owner",*get_owner(id)) );
|
||||
}
|
||||
|
||||
for( auto id : required_owner )
|
||||
{
|
||||
GRAPHENE_ASSERT( owner_approvals.find(id) != owner_approvals.end() ||
|
||||
s.check_authority(get_owner(id)),
|
||||
s.check_authority(get_owner(id)),
|
||||
tx_missing_owner_auth, "Missing Owner Authority ${id}", ("id",id)("auth",*get_owner(id)) );
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue