}
}
$sql = "SELECT id, transaction_id FROM bitcoind_log ORDER BY `date` DESC LIMIT 0,100 ";
$result = db_query_array($sql);
if ($result) {
    foreach ($result as $row) {
        $transaction_log[$row['transaction_id']] = $row['id'];
    }
}
$addresses = array();
$user_balances = array();
foreach ($transactions as $t_id) {
    if (!$t_id || $t_id == '.' || $t_id == '..' || $t_id == '.gitignore') {
        continue;
    }
    $transaction = $bitcoin->gettransaction($t_id);
    if (!empty($transaction_log[$t_id])) {
        unlink($transactions_dir . $t_id);
        continue;
    }
    if (empty($transaction['details'])) {
        continue;
    }
    //$raw = $bitcoin->decoderawtransaction($bitcoin->getrawtransaction($t_id));
    //$sender_address = $raw['vout'][1]['scriptPubKey']['addresses'][0];
    $send = false;
    $pending = false;
    $hot_wallet_in = 0;
    foreach ($transaction['details'] as $detail) {
        if ($detail['category'] == 'receive') {
            // identify the user and request id
Exemple #2
0
function BackendBlocksUpdate()
{
    //	debuglog(__METHOD__);
    $t1 = microtime(true);
    $list = getdbolist('db_blocks', "category='immature' order by time");
    foreach ($list as $block) {
        $coin = getdbo('db_coins', $block->coin_id);
        if (!$coin || !$coin->enable) {
            $block->delete();
            continue;
        }
        $remote = new Bitcoin($coin->rpcuser, $coin->rpcpasswd, $coin->rpchost, $coin->rpcport);
        if (empty($block->txhash)) {
            $blockext = $remote->getblock($block->blockhash);
            if (!$blockext || !isset($blockext['tx'][0])) {
                continue;
            }
            $block->txhash = $blockext['tx'][0];
        }
        $tx = $remote->gettransaction($block->txhash);
        if (!$tx) {
            continue;
        }
        $block->confirmations = $tx['confirmations'];
        if ($block->confirmations == -1) {
            $block->category = 'orphan';
        } else {
            if (isset($tx['details']) && isset($tx['details'][0])) {
                $block->category = $tx['details'][0]['category'];
            } else {
                if (isset($tx['category'])) {
                    $block->category = $tx['category'];
                }
            }
        }
        $block->save();
        if ($block->category == 'generate') {
            dborun("update earnings set status=1, mature_time=UNIX_TIMESTAMP() where blockid={$block->id}");
        } else {
            if ($block->category != 'immature') {
                dborun("delete from earnings where blockid={$block->id}");
            }
        }
    }
    $d1 = microtime(true) - $t1;
    controller()->memcache->add_monitoring_function(__METHOD__, $d1);
}