Beispiel #1
0
int main(int argc, char *argv[])
{
    int flag;
    int listenfd;

    parse_args(argc, argv);
    ignore_signal();
    verify_authority();
    load_config();
    flag = systemlog_init(isdaemon? OUT_LOGFILE : OUT_SCREEN, LOG_FILENAME);
    if (flag == -1) {
        FATAL("log file can't create!(%s)\n", strerror(errno));
        return 0;
    }

    if (isdaemon)
        daemon(1, 0);
    threadpool = Tpool_new(nthread);
    Tpool_run(threadpool);

    listenfd = anet_tcp_server(listen_ip, listen_port, 0);
    if (listenfd == -1) {
        FATAL("Server Initialize fail!(%s)", strerror(errno));
        goto free;
    }
    INFO("Server Initialize successful!");
    for (;;) {
        long clientfd = anet_tcp_accept(listenfd, 0);
        if (clientfd == -1) {
            FATAL("accept fail!(%s)\n", strerror(errno));
            close(listenfd);
            goto free;
        }
        Tpool_addwork(threadpool, accept_request, (void*)clientfd);
    }
free:
    Tpool_free(threadpool);
    systemlog_close();
    return 0;
}
bool proposal_object::is_authorized_to_execute(database& db) const
{
   transaction_evaluation_state dry_run_eval(&db);

   try {
      bool allow_non_immediate_owner = ( db.head_block_time() >= HARDFORK_CORE_584_TIME );
      verify_authority( proposed_transaction.operations, 
                        available_key_approvals,
                        [&]( account_id_type id ){ return &id(db).active; },
                        [&]( account_id_type id ){ return &id(db).owner;  },
                        allow_non_immediate_owner,
                        db.get_global_properties().parameters.max_authority_depth,
                        true, /* allow committeee */
                        available_active_approvals,
                        available_owner_approvals );
   } 
   catch ( const fc::exception& e )
   {
      return false;
   }
   return true;
}
Beispiel #3
0
bool proposal_object::is_authorized_to_execute(database& db) const
{
   transaction_evaluation_state dry_run_eval(&db);

   try {
      verify_authority( proposed_transaction.operations, 
                        available_key_approvals,
                        [&]( account_id_type id ){ return &id(db).active; },
                        [&]( account_id_type id ){ return &id(db).owner;  },
                        db.get_global_properties().parameters.max_authority_depth,
                        true, /* allow committeee */
                        available_active_approvals,
                        available_owner_approvals );
   } 
   catch ( const fc::exception& e )
   {
      //idump((available_active_approvals));
      //wlog((e.to_detail_string()));
      return false;
   }
   return true;
}