diff --git a/app/lib/blockchain/DuniterBlockchain.ts b/app/lib/blockchain/DuniterBlockchain.ts index 9ab3e5efa2629bdf339e551292f3327d4c1907bb..063a095053c85b91d8b9495532c5bdde7c93e24b 100644 --- a/app/lib/blockchain/DuniterBlockchain.ts +++ b/app/lib/blockchain/DuniterBlockchain.ts @@ -545,6 +545,7 @@ export class DuniterBlockchain { if (block) { await this.undoDeleteTransactions(block, dal); } + NewLogger().info("Reverted block #%s", blockstamp); } static async undoMembersUpdate(blockstamp: string, dal: FileDAL) { diff --git a/app/lib/blockchain/Switcher.ts b/app/lib/blockchain/Switcher.ts index f600aeedfa7bde0e465df80714c2d3cc6d942250..ebeb59acc1395b63c3c9a908182fe70ad5130163 100644 --- a/app/lib/blockchain/Switcher.ts +++ b/app/lib/blockchain/Switcher.ts @@ -277,6 +277,11 @@ export class Switcher<T extends SwitchBlock> { s[0].number + i, e && e.message ); + if (e.type === "NotFoundError" && this.logger) { + this.logger.error( + "CRITICAL: LevelDB has inconsistent state: " + e.stack + ); + } added = false; } i++; diff --git a/app/lib/computation/BlockchainContext.ts b/app/lib/computation/BlockchainContext.ts index a0589908f1a50ae43493ff21daafcd25d29a0ada..4ec0d79345ce71dc7269e123308fbe314e9e85cf 100644 --- a/app/lib/computation/BlockchainContext.ts +++ b/app/lib/computation/BlockchainContext.ts @@ -165,7 +165,7 @@ export class BlockchainContext { async revertCurrentBlock(): Promise<DBBlock> { const head_1 = await this.dal.bindexDAL.head(1); - this.logger.debug("Reverting block #%s...", head_1.number); + this.logger.debug("Reverting block #%s-%s...", head_1.number, head_1.hash); const block = await this.dal.getAbsoluteValidBlockInForkWindow( head_1.number, head_1.hash diff --git a/app/modules/dump/blocks/dump.blocks.ts b/app/modules/dump/blocks/dump.blocks.ts index f0967048486f6adacec248205fe03dc2a10d3b31..19229811d2ccabfaee877fc124534631dce229c5 100644 --- a/app/modules/dump/blocks/dump.blocks.ts +++ b/app/modules/dump/blocks/dump.blocks.ts @@ -28,5 +28,9 @@ export async function dumpBlocks( } export function dumpBlockIfDefined(b: DBBlock | undefined | null) { + console.log("-------- BLOCK --------"); + console.log("Number: " + b?.number); + console.log("Hash: " + b?.hash); + console.log(""); console.log(BlockDTO.fromJSONObject(b).getRawSigned()); }