mirror of
https://github.com/kvazar-network/crawler-api-node.git
synced 2025-01-22 04:44:28 +00:00
update line brakes
This commit is contained in:
parent
bfc73fd8bd
commit
304c37aac0
24
crawler.php
24
crawler.php
@ -24,14 +24,14 @@ $blockLast = $db->getLastBlock();
|
|||||||
$blockTotal = $api->getblockcount();
|
$blockTotal = $api->getblockcount();
|
||||||
|
|
||||||
if (false === $blockTotal) {
|
if (false === $blockTotal) {
|
||||||
echo "API connection error.\n";
|
echo "API connection error." . PHP_EOL;
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = [];
|
$response = [];
|
||||||
|
|
||||||
if (CRAWLER_DEBUG) {
|
if (CRAWLER_DEBUG) {
|
||||||
echo "scanning blockhain...\n";
|
echo "scanning blockhain..." . PHP_EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for ($blockCurrent = ($blockLast + 1); $blockCurrent <= $blockLast + STEP_BLOCK_LIMIT; $blockCurrent++) {
|
for ($blockCurrent = ($blockLast + 1); $blockCurrent <= $blockLast + STEP_BLOCK_LIMIT; $blockCurrent++) {
|
||||||
@ -39,20 +39,20 @@ for ($blockCurrent = ($blockLast + 1); $blockCurrent <= $blockLast + STEP_BLOCK_
|
|||||||
if ($blockCurrent > $blockTotal) {
|
if ($blockCurrent > $blockTotal) {
|
||||||
|
|
||||||
if (CRAWLER_DEBUG) {
|
if (CRAWLER_DEBUG) {
|
||||||
echo "database is up to date.\n";
|
echo "database is up to date." . PHP_EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CRAWLER_DEBUG) {
|
if (CRAWLER_DEBUG) {
|
||||||
echo sprintf("reading block %s\n", $blockCurrent);
|
echo sprintf("reading block %s", $blockCurrent) . PHP_EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$blockHash = $api->getblockhash($blockCurrent)) {
|
if (!$blockHash = $api->getblockhash($blockCurrent)) {
|
||||||
|
|
||||||
if (CRAWLER_DEBUG) {
|
if (CRAWLER_DEBUG) {
|
||||||
echo "could not read the block hash. waiting for reconnect.\n";
|
echo "could not read the block hash. waiting for reconnect." . PHP_EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -61,7 +61,7 @@ for ($blockCurrent = ($blockLast + 1); $blockCurrent <= $blockLast + STEP_BLOCK_
|
|||||||
if (!$blockData = $api->getblock($blockHash)) {
|
if (!$blockData = $api->getblock($blockHash)) {
|
||||||
|
|
||||||
if (CRAWLER_DEBUG) {
|
if (CRAWLER_DEBUG) {
|
||||||
echo "could not read the block data. waiting for reconnect.\n";
|
echo "could not read the block data. waiting for reconnect." . PHP_EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -71,7 +71,7 @@ for ($blockCurrent = ($blockLast + 1); $blockCurrent <= $blockLast + STEP_BLOCK_
|
|||||||
$blockId = $db->addBlock($blockCurrent);
|
$blockId = $db->addBlock($blockCurrent);
|
||||||
|
|
||||||
if (CRAWLER_DEBUG) {
|
if (CRAWLER_DEBUG) {
|
||||||
echo sprintf("add block %s\n", $blockCurrent);
|
echo sprintf("add block %s", $blockCurrent) . PHP_EOL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ for ($blockCurrent = ($blockLast + 1); $blockCurrent <= $blockLast + STEP_BLOCK_
|
|||||||
$db->setLostTransactions($blockId, $lostTransactions);
|
$db->setLostTransactions($blockId, $lostTransactions);
|
||||||
|
|
||||||
if (CRAWLER_DEBUG) {
|
if (CRAWLER_DEBUG) {
|
||||||
echo sprintf("could not read the transaction %s. skipped.\n", $transaction);
|
echo sprintf("could not read the transaction %s. skipped.", $transaction) . PHP_EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -126,7 +126,7 @@ for ($blockCurrent = ($blockLast + 1); $blockCurrent <= $blockLast + STEP_BLOCK_
|
|||||||
$nameSpaceId = $db->addNameSpace($hash);
|
$nameSpaceId = $db->addNameSpace($hash);
|
||||||
|
|
||||||
if (CRAWLER_DEBUG) {
|
if (CRAWLER_DEBUG) {
|
||||||
echo sprintf("add namespace %s\n", $hash);
|
echo sprintf("add namespace %s", $hash) . PHP_EOL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,7 +146,7 @@ for ($blockCurrent = ($blockLast + 1); $blockCurrent <= $blockLast + STEP_BLOCK_
|
|||||||
$db->setDataKeyDeleted($nameSpaceId, $key, false);
|
$db->setDataKeyDeleted($nameSpaceId, $key, false);
|
||||||
|
|
||||||
if (CRAWLER_DEBUG) {
|
if (CRAWLER_DEBUG) {
|
||||||
echo sprintf("add new key/value %s\n", $transactionRaw['txid']);
|
echo sprintf("add new key/value %s", $transactionRaw['txid']) . PHP_EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -154,7 +154,7 @@ for ($blockCurrent = ($blockLast + 1); $blockCurrent <= $blockLast + STEP_BLOCK_
|
|||||||
$db->setDataKeyDeleted($nameSpaceId, $key, true);
|
$db->setDataKeyDeleted($nameSpaceId, $key, true);
|
||||||
|
|
||||||
if (CRAWLER_DEBUG) {
|
if (CRAWLER_DEBUG) {
|
||||||
echo sprintf("delete key %s from namespace %s\n", $key, $hash);
|
echo sprintf("delete key %s from namespace %s", $key, $hash) . PHP_EOL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -182,6 +182,6 @@ for ($blockCurrent = ($blockLast + 1); $blockCurrent <= $blockLast + STEP_BLOCK_
|
|||||||
|
|
||||||
// Debug
|
// Debug
|
||||||
if (CRAWLER_DEBUG) {
|
if (CRAWLER_DEBUG) {
|
||||||
echo "scanning completed.\n";
|
echo "scanning completed." . PHP_EOL;
|
||||||
# print_r($response);
|
# print_r($response);
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user