diff --git a/yarn-project/kv-store/src/lmdb/store.test.ts b/yarn-project/kv-store/src/lmdb/store.test.ts index dc6f5f67755c..b443b630528c 100644 --- a/yarn-project/kv-store/src/lmdb/store.test.ts +++ b/yarn-project/kv-store/src/lmdb/store.test.ts @@ -20,11 +20,16 @@ describe('AztecLmdbStore', () => { }; it('forks a persistent store', async () => { - const path = join(await mkdtemp(join(tmpdir(), 'aztec-store-test-')), 'main.mdb'); + const path = await mkdtemp(join(tmpdir(), 'aztec-store-test-')); const store = AztecLmdbStore.open(path, false); await itForks(store); }); + it('forks a persistent store with no path', async () => { + const store = AztecLmdbStore.open(undefined, false); + await itForks(store); + }); + it('forks an ephemeral store', async () => { const store = AztecLmdbStore.open(undefined, true); await itForks(store); diff --git a/yarn-project/kv-store/src/lmdb/store.ts b/yarn-project/kv-store/src/lmdb/store.ts index f23ca16338c5..bbcf341859da 100644 --- a/yarn-project/kv-store/src/lmdb/store.ts +++ b/yarn-project/kv-store/src/lmdb/store.ts @@ -72,7 +72,8 @@ export class AztecLmdbStore implements AztecKVStore { async fork() { const baseDir = this.path ? dirname(this.path) : tmpdir(); this.#log.debug(`Forking store with basedir ${baseDir}`); - const forkPath = join(await mkdtemp(join(baseDir, 'aztec-store-fork-')), 'root.mdb'); + const forkPath = + (await mkdtemp(join(baseDir, 'aztec-store-fork-'))) + (this.isEphemeral || !this.path ? '/data.mdb' : ''); this.#log.verbose(`Forking store to ${forkPath}`); await this.#rootDb.backup(forkPath, false); const forkDb = open(forkPath, { noSync: this.isEphemeral });