common.cpp 776 字节
Newer Older
1 2 3 4 5 6
#include "common.hpp"

#include <eosiolib/chain.h>

namespace identity {

7
   bool identity_base::is_trusted_by( account_name trusted, account_name by ) {
8 9 10 11
      trust_table t( _self, by );
      return t.find( trusted ) != t.end();
   }

12 13
   bool identity_base::is_trusted( account_name acnt ) {
      account_name active_producers[21];
14
      auto active_prod_size = get_active_producers( active_producers, sizeof(active_producers) );
15
      auto count = active_prod_size / sizeof(account_name);
16 17 18 19 20
      for( size_t i = 0; i < count; ++i ) {
         if( active_producers[i] == acnt )
            return true;
      }
      for( size_t i = 0; i < count; ++i ) {
21
         if( is_trusted_by( acnt, active_producers[i] ) )
22 23 24 25 26 27
            return true;
      }
      return false;
   }

}