Browse Source

init block reader

main
ghost 10 months ago
parent
commit
016a963cb4
  1. 3
      .gitignore
  2. 38
      src/index.php

3
.gitignore vendored

@ -1,4 +1,5 @@ @@ -1,4 +1,5 @@
/vendor/
/composer.lock
/config.json
/config.json
/.block

38
src/index.php

@ -26,6 +26,24 @@ $config = json_decode( @@ -26,6 +26,24 @@ $config = json_decode(
)
);
// Init block
$block = 0;
if (file_exists(__DIR__ . '/../.block'))
{
$block = (int) file_get_contents(
__DIR__ . '/../.block'
);
}
else
{
file_put_contents(
__DIR__ . '/../.block',
$block
);
}
// Load dependencies
require_once __DIR__ . '/../vendor/autoload.php';
@ -106,5 +124,23 @@ if (isset($argv[1])) @@ -106,5 +124,23 @@ if (isset($argv[1]))
}
// Begin crawler
if (false === $blocks = $kevacoin->getBlockCount())
{
exit(
_('Could not receive blocks count!')
);
}
// @TODO
for ($i = $block; $i <= $blocks; $i++)
{
echo sprintf(
"%d/%d\r",
$i,
$blocks
);
file_put_contents(
__DIR__ . '/../.block',
$i
);
}
Loading…
Cancel
Save