main_unlock();
        exit;
    }
    debug_print($max_other_currencies_votes, __FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__);
    $total_count_currencies = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\tSELECT count(`id`)\n\t\t\tFROM `" . DB_PREFIX . "currency`\n\t\t\t", 'fetch_one');
    foreach ($max_other_currencies_votes as $currency_id => $count_and_votes) {
        $new_max_other_currencies[$currency_id] = get_max_vote($count_and_votes, 0, $total_count_currencies, 10);
    }
    if (get_community_users($db)) {
        $my_prefix = $testBlock->user_id . '_';
    } else {
        $my_prefix = '';
    }
    $node_private_key = get_node_private_key($db, $my_prefix);
    $json_data = json_encode($new_max_other_currencies);
    // подписываем нашим нод-ключем данные транзакции
    $data_for_sign = ParseData::findType('new_max_other_currencies') . ",{$time},{$my_user_id},{$json_data}";
    $rsa = new Crypt_RSA();
    $rsa->loadKey($node_private_key);
    $rsa->setSignatureMode(CRYPT_RSA_SIGNATURE_PKCS1);
    $signature = $rsa->sign($data_for_sign);
    debug_print('$data_for_sign=' . $data_for_sign . "\n", __FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__);
    // создаем тр-ию. пишем $block_id, на момент которого были актуальны голоса в табле 'pct'
    $data = dec_binary(ParseData::findType('new_max_other_currencies'), 1) . dec_binary($time, 4) . ParseData::encode_length_plus_data($my_user_id) . ParseData::encode_length_plus_data($json_data) . ParseData::encode_length_plus_data($signature);
    $hash = ParseData::dsha256($data);
    insert_tx($data, $db);
    $new_tx_data['data'] = $data;
    $new_tx_data['hash'] = hextobin(md5($data));
    tx_parser($new_tx_data, true);
}
main_unlock();
Ejemplo n.º 2
0
function all_tx_parser()
{
    global $db;
    // берем тр-ии
    $res = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\tSELECT *\n            FROM (\n\t            SELECT `data`,\n\t                         `hash`\n\t            FROM `" . DB_PREFIX . "queue_tx`\n\t\t\t\tUNION\n\t\t\t\tSELECT `data`,\n\t\t\t\t\t\t\t `hash`\n\t\t\t\tFROM `" . DB_PREFIX . "transactions`\n\t\t\t\tWHERE `verified` = 0 AND\n\t\t\t\t\t\t\t `used` = 0\n\t\t\t)  AS `x`\n\t\t\t");
    while ($new_tx_data = $db->fetchArray($res)) {
        tx_parser($new_tx_data);
    }
}