@corpus-core/colibri-stateless 0.2.3 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corpus-core/colibri-stateless",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "Colibri is a stateless and trustless ethereum client, which is optimized for the mobile apps or embedded devices, because it does not hols the state, but verifies on demand.",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -155,9 +155,10 @@ export class SubscriptionManager {
155
155
  if (currentVerifiableBlockNumber) {
156
156
  let fromBlock = sub.lastPolledBlockNumber ? sub.lastPolledBlockNumber + 1n : currentVerifiableBlockNumber;
157
157
  if (sub.kind === 'newHeads') { // For newHeads, we only care if the latest is newer
158
- if (!sub.lastPolledBlockNumber || currentVerifiableBlockNumber <= sub.lastPolledBlockNumber) {
158
+ if (!sub.lastPolledBlockNumber)
159
+ sub.lastPolledBlockNumber = currentVerifiableBlockNumber;
160
+ if (currentVerifiableBlockNumber <= sub.lastPolledBlockNumber)
159
161
  return []; // No new head yet for eth_subscribe('newHeads')
160
- }
161
162
  // If new, target currentVerifiableBlockNumber for eth_getBlockByNumber
162
163
  fromBlock = currentVerifiableBlockNumber;
163
164
  }