34 namespace graphene {
namespace protocol {
60 FC_ASSERT(
operations.size() > 0,
"A transaction must have at least one operation", (
"trx",*
this) );
81 return signatures.back();
104 flat_set<account_id_type>& owner,
105 vector<authority>& other,
106 bool ignore_custom_operation_required_auths )
const
110 for(
const auto& account : owner )
111 active.erase( account );
132 return itr->second =
true;
147 (*available_address_sigs)[
address(item) ] = item;
154 (*provided_address_sigs)[
address(item.first) ] = item.first;
183 if( au ==
nullptr )
return false;
186 uint32_t total_weight = 0;
190 total_weight += k.second;
198 total_weight += k.second;
213 total_weight += a.second;
220 total_weight += a.second;
230 vector<public_key_type> remove_sigs;
232 if( !sig.second ) remove_sigs.push_back( sig.first );
234 for(
auto& sig : remove_sigs )
237 return remove_sigs.size() != 0;
241 const std::function<
const authority*(account_id_type)>& active,
242 const std::function<
const authority*(account_id_type)>& owner,
252 for(
const auto& key : sigs )
269 void verify_authority(
const vector<operation>& ops,
const flat_set<public_key_type>& sigs,
270 const std::function<
const authority*(account_id_type)>& get_active,
271 const std::function<
const authority*(account_id_type)>& get_owner,
273 bool allow_non_immediate_owner,
274 bool ignore_custom_operation_required_auths,
275 uint32_t max_recursion_depth,
276 bool allow_committee,
277 const flat_set<account_id_type>& active_aprovals,
278 const flat_set<account_id_type>& owner_approvals )
282 flat_set<account_id_type> required_active;
283 flat_set<account_id_type> required_owner;
284 vector<authority> other;
286 sign_state s( sigs, get_active, get_owner, allow_non_immediate_owner, max_recursion_depth );
287 for(
auto&
id : active_aprovals )
289 for(
auto&
id : owner_approvals )
292 auto approved_by_custom_authority = [&s, &rejected_custom_auths, get_custom = std::move(get_custom)](
293 account_id_type account,
295 auto viable_custom_auths = get_custom( account, op, &rejected_custom_auths );
296 for(
const auto& auth : viable_custom_auths )
301 for(
const auto& op : ops ) {
302 flat_set<account_id_type> operation_required_active;
304 ignore_custom_operation_required_auths );
306 auto itr = operation_required_active.begin();
307 while ( itr != operation_required_active.end() ) {
308 if ( approved_by_custom_authority( *itr, op ) )
309 itr = operation_required_active.erase( itr );
314 required_active.insert( operation_required_active.begin(), operation_required_active.end() );
317 if( !allow_committee )
319 invalid_committee_approval,
"Committee account may only propose transactions" );
321 for(
const auto& auth : other )
327 for(
auto id : required_owner )
331 tx_missing_owner_auth,
"Missing Owner Authority ${id}", (
"id",
id)(
"auth",*get_owner(
id)) );
334 for(
auto id : required_active )
338 tx_missing_active_auth,
"Missing Active Authority ${id}",
339 (
"id",
id)(
"auth",*get_active(
id))(
"owner",*get_owner(
id)) );
345 "Unnecessary signature(s) detected"
353 flat_set<public_key_type> result;
359 "Duplicate Signature detected" );
367 const flat_set<public_key_type>& available_keys,
368 const std::function<
const authority*(account_id_type)>& get_active,
369 const std::function<
const authority*(account_id_type)>& get_owner,
370 bool allow_non_immediate_owner,
371 bool ignore_custom_operation_required_authorities,
372 uint32_t max_recursion_depth )
const
374 flat_set<account_id_type> required_active;
375 flat_set<account_id_type> required_owner;
376 vector<authority> other;
380 sign_state s( signature_keys, get_active, get_owner, allow_non_immediate_owner, max_recursion_depth, available_keys );
382 for(
const auto& auth : other )
384 for(
auto& owner : required_owner )
386 for(
auto& active : required_active )
391 set<public_key_type> result;
394 if( available_keys.find( provided_sig.first ) != available_keys.end()
395 && signature_keys.find( provided_sig.first ) == signature_keys.end() )
396 result.insert( provided_sig.first );
403 const flat_set<public_key_type>& available_keys,
404 const std::function<
const authority*(account_id_type)>& get_active,
405 const std::function<
const authority*(account_id_type)>& get_owner,
407 bool allow_non_immediate_owner,
408 bool ignore_custom_operation_required_auths,
409 uint32_t max_recursion )
const
412 allow_non_immediate_owner,
413 ignore_custom_operation_required_auths, max_recursion );
414 flat_set< public_key_type > result( s.begin(), s.end() );
422 allow_non_immediate_owner,ignore_custom_operation_required_auths,
426 catch(
const tx_missing_owner_auth& e ) {}
427 catch(
const tx_missing_active_auth& e ) {}
428 catch(
const tx_missing_other_auth& e ) {}
431 return set<public_key_type>( result.begin(), result.end() );
465 const std::function<
const authority*(account_id_type)>& get_active,
466 const std::function<
const authority*(account_id_type)>& get_owner,
468 bool allow_non_immediate_owner,
469 bool ignore_custom_operation_required_auths,
470 uint32_t max_recursion )
const
473 get_custom, allow_non_immediate_owner,
474 ignore_custom_operation_required_auths, max_recursion );