diff --git a/packages/node/src/utils/kyve/kyve.spec.ts b/packages/node/src/utils/kyve/kyve.spec.ts index faac5d903..da2d9f1a9 100644 --- a/packages/node/src/utils/kyve/kyve.spec.ts +++ b/packages/node/src/utils/kyve/kyve.spec.ts @@ -324,14 +324,10 @@ describe('KyveApi', () => { }); it('remove cached bundle files when past height', async () => { await kyveApi.fetchBlocksBatches(registry, [1, 151, 301, 501], 300); - const files = await fs.promises.readdir(tmpPath); - await kyveApi.fetchBlocksBatches(registry, [502, 504, 600, 800], 300); - console.log(files); + const files = await fs.promises.readdir(tmpPath); expect(files).not.toContain('bundle_0.json'); - expect(files).not.toContain('bundle_1.json'); - expect(files).not.toContain('bundle_2.json'); }); it('ensure to remove logic', () => { const cachedBundleDetails = [ diff --git a/packages/node/src/utils/kyve/kyve.ts b/packages/node/src/utils/kyve/kyve.ts index a99470d7e..e34361538 100644 --- a/packages/node/src/utils/kyve/kyve.ts +++ b/packages/node/src/utils/kyve/kyve.ts @@ -316,9 +316,7 @@ export class KyveApi { bufferSize, ); - if (toRemoveBundles.length) { - console.log('bundle not found', height); - console.log('bundle not found cache', this.cachedBundleDetails.length); + if (!toRemoveBundles.length) { return; } @@ -327,7 +325,6 @@ export class KyveApi { try { await fs.promises.unlink(bundlePath); remove(this.cachedBundleDetails, (b) => b.id === bundle.id); - console.log('cache after removal', this.cachedBundleDetails.length); } catch (e) { if (e.code === 'ENOENT') { console.error(e); @@ -361,7 +358,7 @@ export class KyveApi { (b.log as any) = JSON.stringify(this.reconstructLogs(kyveBlockResult)); }); } catch (e) { - throw new Error(`Failed to inject kyveBlock`); + throw new Error(`Failed to inject kyveBlock, ${e}`); } return kyveBlockResult; }