diff --git a/lib/blockstore/file.js b/lib/blockstore/file.js index a687f224..51cc31d8 100644 --- a/lib/blockstore/file.js +++ b/lib/blockstore/file.js @@ -32,7 +32,7 @@ class FileBlockStore extends AbstractBlockStore { */ constructor(options) { - super(); + super(options); assert(isAbsolute(options.location), 'Location not absolute.'); @@ -101,7 +101,7 @@ class FileBlockStore extends AbstractBlockStore { if (!missing) return; - this.logger.info(`Indexing block type ${type}...`); + this.logger.info('Indexing block type %d...', type); for (const fileno of filenos) { const b = this.db.batch(); @@ -166,7 +166,7 @@ class FileBlockStore extends AbstractBlockStore { await b.write(); - this.logger.info(`Indexed ${blocks} blocks from ${filepath}...`); + this.logger.info('Indexed %d blocks (file=%s).', blocks, filepath); } } diff --git a/lib/blockstore/level.js b/lib/blockstore/level.js index ebc09675..bb0f7f6c 100644 --- a/lib/blockstore/level.js +++ b/lib/blockstore/level.js @@ -26,7 +26,7 @@ class LevelBlockStore extends AbstractBlockStore { */ constructor(options) { - super(); + super(options); this.location = options.location; diff --git a/test/blockstore-test.js b/test/blockstore-test.js index 160538de..25ed17e9 100644 --- a/test/blockstore-test.js +++ b/test/blockstore-test.js @@ -292,6 +292,23 @@ describe('BlockStore', function() { }); describe('constructor', function() { + it('will pass options to super', () => { + const info = () => 'info'; + const logger = { + context: () => { + return {info}; + } + }; + + const store = new FileBlockStore({ + location: '/tmp/.bcoin/blocks', + maxFileLength: 1024, + logger: logger + }); + + assert.strictEqual(store.logger.info, info); + }); + it('will error with invalid location', () => { let err = null;