@telosnetwork/hyperion-sequential-reader
Advanced tools
Comparing version 1.2.7-rc11 to 1.2.7-rc12
@@ -13,2 +13,3 @@ /// <reference types="node" /> | ||
irreversibleOnly?: boolean; | ||
fetchBlock?: boolean; | ||
fetchTraces?: boolean; | ||
@@ -95,2 +96,3 @@ fetchDeltas?: boolean; | ||
private irreversibleOnly; | ||
private fetchBlock; | ||
private fetchTraces; | ||
@@ -97,0 +99,0 @@ private fetchDeltas; |
@@ -59,2 +59,3 @@ import { EventEmitter } from "events"; | ||
irreversibleOnly; | ||
fetchBlock; | ||
fetchTraces; | ||
@@ -68,8 +69,8 @@ fetchDeltas; | ||
this.options = options; | ||
this.logLevel = options.logLevel || 'warning'; | ||
this.logLevel = options.logLevel ?? 'warning'; | ||
this.shipApi = options.shipApi; | ||
this.max_payload_mb = options.maxPayloadMb || 256; | ||
this.maxMsgsInFlight = options.maxMsgsInFlight || 100; | ||
this.max_payload_mb = options.maxPayloadMb ?? 256; | ||
this.maxMsgsInFlight = options.maxMsgsInFlight ?? 100; | ||
this.ship = new StateHistorySocket(this.shipApi, this.max_payload_mb); | ||
this.blockHistorySize = options.blockHistorySize || HIST_TIME; | ||
this.blockHistorySize = options.blockHistorySize ?? HIST_TIME; | ||
this.blockHistory = new OrderedSet(this.blockHistorySize); | ||
@@ -83,12 +84,13 @@ // placeholder store | ||
this.createWorkers({ | ||
poolSize: options.poolSize || 1, | ||
logLevel: options.workerLogLevel || 'warning' | ||
poolSize: options.poolSize ?? 1, | ||
logLevel: options.workerLogLevel ?? 'warning' | ||
}); | ||
this.irreversibleOnly = options.irreversibleOnly || false; | ||
this.fetchDeltas = options.fetchDeltas || true; | ||
this.fetchTraces = options.fetchTraces || true; | ||
this.startBlock = options.startBlock || -1; | ||
this.irreversibleOnly = options.irreversibleOnly ?? false; | ||
this.fetchBlock = options.fetchBlock ?? true; | ||
this.fetchDeltas = options.fetchDeltas ?? true; | ||
this.fetchTraces = options.fetchTraces ?? true; | ||
this.startBlock = options.startBlock ?? -1; | ||
this.lastEmittedBlock = this.startBlock - 1; | ||
this.nextBlockRequested = this.startBlock; | ||
this.endBlock = options.endBlock || -1; | ||
this.endBlock = options.endBlock ?? -1; | ||
if (!options.endBlock && !options.startBlock) { | ||
@@ -98,3 +100,3 @@ this.blockConcurrency = 1; | ||
else { | ||
this.blockConcurrency = options.blockConcurrency || 5; | ||
this.blockConcurrency = options.blockConcurrency ?? 5; | ||
} | ||
@@ -318,3 +320,3 @@ if (options.inputQueueLimit) { | ||
irreversible_only: this.irreversibleOnly, | ||
fetch_block: true, | ||
fetch_block: this.fetchBlock, | ||
fetch_traces: this.fetchTraces, | ||
@@ -359,2 +361,5 @@ fetch_deltas: this.fetchDeltas, | ||
this.blockHistory.add(blockNum); | ||
const extendedActions = []; | ||
const extendedDeltas = []; | ||
let blockHeader = null; | ||
if (resultElement.block && blockNum) { | ||
@@ -366,3 +371,3 @@ const block = Serializer.decode({ | ||
}); | ||
const blockHeader = Serializer.objectify({ | ||
blockHeader = Serializer.objectify({ | ||
timestamp: block.timestamp, | ||
@@ -380,3 +385,2 @@ producer: block.producer, | ||
}); | ||
const extendedDeltas = []; | ||
if (resultElement.deltas) { | ||
@@ -455,3 +459,2 @@ const deltaArrays = Serializer.decode({ | ||
} | ||
const extendedActions = []; | ||
if (resultElement.traces) { | ||
@@ -521,22 +524,22 @@ const traces = Serializer.decode({ | ||
} | ||
const nBlock = { | ||
ready: false, | ||
blockInfo, | ||
blockHeader, | ||
counters: { | ||
actions: 0, | ||
deltas: 0 | ||
}, | ||
targets: { | ||
actions: extendedActions.length, | ||
deltas: extendedDeltas.length, | ||
}, | ||
deltas: extendedDeltas, | ||
actions: extendedActions, | ||
createdAt: process.hrtime.bigint() | ||
}; | ||
this.blockCollector.set(blockNum, nBlock); | ||
if (extendedDeltas.length == 0 && extendedActions.length == 0) | ||
this.checkBlock(nBlock); | ||
} | ||
const nBlock = { | ||
ready: false, | ||
blockInfo, | ||
blockHeader, | ||
counters: { | ||
actions: 0, | ||
deltas: 0 | ||
}, | ||
targets: { | ||
actions: extendedActions.length, | ||
deltas: extendedDeltas.length, | ||
}, | ||
deltas: extendedDeltas, | ||
actions: extendedActions, | ||
createdAt: process.hrtime.bigint() | ||
}; | ||
this.blockCollector.set(blockNum, nBlock); | ||
if (extendedDeltas.length == 0 && extendedActions.length == 0) | ||
this.checkBlock(nBlock); | ||
} | ||
@@ -543,0 +546,0 @@ createWorkers(param) { |
@@ -15,2 +15,5 @@ import { HyperionSequentialReader } from "../reader.js"; | ||
endBlock: -1, | ||
fetchBlock: false, | ||
fetchTraces: false, | ||
fetchDeltas: false, | ||
actionWhitelist: { | ||
@@ -17,0 +20,0 @@ 'eosio.token': ['transfer'], |
{ | ||
"name": "@telosnetwork/hyperion-sequential-reader", | ||
"repository": "telosnetwork/hyperion-sequential-reader", | ||
"version": "1.2.7-rc11", | ||
"version": "1.2.7-rc12", | ||
"description": "", | ||
@@ -6,0 +6,0 @@ "main": "./lib/esm/index.js", |
54476
1440