mirror of
https://github.com/kvazar-network/crawler.git
synced 2025-01-08 22:27:56 +00:00
skip processed transactions
This commit is contained in:
parent
d681689aac
commit
0e2a088b20
@ -191,6 +191,9 @@ for ($block = $state + 1; $block <= $blocks; $block++)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reset memory pool of processed transactions for each new block
|
||||||
|
$transactions = [];
|
||||||
|
|
||||||
// Process each transaction in block
|
// Process each transaction in block
|
||||||
foreach ((array) $data['tx'] as $transaction)
|
foreach ((array) $data['tx'] as $transaction)
|
||||||
{
|
{
|
||||||
@ -313,9 +316,13 @@ for ($block = $state + 1; $block <= $blocks; $block++)
|
|||||||
$namespace
|
$namespace
|
||||||
) as $record)
|
) as $record)
|
||||||
{
|
{
|
||||||
|
if (
|
||||||
// Get current block transactions only
|
// Get current block transactions only
|
||||||
if ($record['height'] === $block)
|
$record['height'] === $block
|
||||||
{
|
&&
|
||||||
|
// Skip processed transactions for this namespace
|
||||||
|
!in_array($raw['txid'], $transactions)
|
||||||
|
) {
|
||||||
// Register new transaction
|
// Register new transaction
|
||||||
$index->add(
|
$index->add(
|
||||||
$raw['time'],
|
$raw['time'],
|
||||||
@ -327,6 +334,9 @@ for ($block = $state + 1; $block <= $blocks; $block++)
|
|||||||
$record['key'],
|
$record['key'],
|
||||||
$record['value']
|
$record['value']
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Register processed transaction
|
||||||
|
$transactions[] = $raw['txid'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user