From f1dba278b68a910a216c4952d88ab62d6834783b Mon Sep 17 00:00:00 2001 From: harkamal Date: Sun, 18 Aug 2024 20:04:40 +0530 Subject: [PATCH] further debug and fix the beacon sync sim test and get it working --- packages/blockchain/src/blockchain.ts | 7 ++++++- packages/client/test/sync/skeleton.spec.ts | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/blockchain/src/blockchain.ts b/packages/blockchain/src/blockchain.ts index d2d3c5d5a3d..b869b9c7ec0 100644 --- a/packages/blockchain/src/blockchain.ts +++ b/packages/blockchain/src/blockchain.ts @@ -378,7 +378,12 @@ export class Blockchain implements BlockchainInterface { ) } - if (this._validateBlocks && !isGenesis && item instanceof Block && optimisticOpts === undefined) { + if ( + this._validateBlocks && + !isGenesis && + item instanceof Block && + optimisticOpts === undefined + ) { // this calls into `getBlock`, which is why we cannot lock yet await this.validateBlock(block) } diff --git a/packages/client/test/sync/skeleton.spec.ts b/packages/client/test/sync/skeleton.spec.ts index b55bdff7086..383a0b17859 100644 --- a/packages/client/test/sync/skeleton.spec.ts +++ b/packages/client/test/sync/skeleton.spec.ts @@ -242,6 +242,7 @@ describe('[Skeleton] / initSync', async () => { storageCache: 1000, }) const chain = await Chain.create({ config }) + ;(chain.blockchain as any)._validateBlocks = false const skeleton = new Skeleton({ chain, config, metaDB: new MemoryLevel() }) await skeleton.open() @@ -359,6 +360,7 @@ describe('[Skeleton] / setHead', async () => { storageCache: 1000, }) const chain = await Chain.create({ config }) + ;(chain.blockchain as any)._validateBlocks = false const skeleton = new Skeleton({ chain, config, metaDB: new MemoryLevel() }) await skeleton.open() for (const block of testCase.blocks ?? []) {