Comparing version
@@ -53,2 +53,3 @@ import { Block, Effect, IndexState, Updater } from "./interfaces"; | ||
protected handleActions(state: any, block: Block, context: any, isReplay: boolean): Promise<void>; | ||
private refreshIndexState; | ||
} |
@@ -32,9 +32,6 @@ "use strict"; | ||
yield this.rollbackTo(blockInfo.blockNumber - 1); | ||
yield this.refreshIndexState(); | ||
} | ||
if (!this.lastProcessedBlockHash && this.lastProcessedBlockNumber === 0) { | ||
const { blockNumber: indexStateBlockNumber, blockHash: indexStateBlockHash } = yield this.loadIndexState(); | ||
if (indexStateBlockNumber && indexStateBlockHash) { | ||
this.lastProcessedBlockNumber = indexStateBlockNumber; | ||
this.lastProcessedBlockHash = indexStateBlockHash; | ||
} | ||
else if (!this.lastProcessedBlockHash && this.lastProcessedBlockNumber === 0) { | ||
yield this.refreshIndexState(); | ||
} | ||
@@ -113,3 +110,10 @@ const nextBlockNeeded = this.lastProcessedBlockNumber + 1; | ||
} | ||
refreshIndexState() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const { blockNumber, blockHash } = yield this.loadIndexState(); | ||
this.lastProcessedBlockNumber = blockNumber; | ||
this.lastProcessedBlockHash = blockHash; | ||
}); | ||
} | ||
} | ||
exports.AbstractActionHandler = AbstractActionHandler; |
@@ -152,3 +152,3 @@ "use strict"; | ||
console.info(` received: ${previousBlockInfo.blockHash}`); | ||
console.info(`Rewinding ${blocksToRewind} blocks to block (${currentBlockInfo.blockNumber})...`); | ||
console.info(`Rolling back ${blocksToRewind} blocks to block ${currentBlockInfo.blockNumber}...`); | ||
break; | ||
@@ -159,3 +159,2 @@ } | ||
console.info(` received: ${previousBlockInfo.blockHash}`); | ||
console.info("Rollback history has been exhausted!"); | ||
} | ||
@@ -177,2 +176,3 @@ this.currentBlockData = previousBlockData; | ||
rollbackExhausted() { | ||
console.info("Rollback history has been exhausted!"); | ||
throw Error("Rollback history has been exhausted, and no rollback exhaustion handling has been implemented."); | ||
@@ -179,0 +179,0 @@ } |
{ | ||
"name": "demux", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"author": { | ||
@@ -5,0 +5,0 @@ "name": "Julien Heller", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
497099
6.02%33
3.13%583
0.87%