Skip to content
This repository was archived by the owner on Apr 6, 2020. It is now read-only.

Commit b9854e4

Browse files
committed
Simplify opts.validate handling
1 parent fa74b13 commit b9854e4

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/index.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,17 @@ export default class Blockchain implements BlockchainInterface {
207207
}
208208

209209
// defaults
210+
211+
if (opts.validate) {
212+
this._validatePow = true
213+
this._validateBlocks = true
214+
} else {
215+
this._validatePow = opts.validatePow !== undefined ? opts.validatePow : false
216+
this._validateBlocks = opts.validateBlocks !== undefined ? opts.validateBlocks : false
217+
}
218+
210219
this.db = opts.db ? opts.db : level()
211220
this.dbManager = new DBManager(this.db, this._common)
212-
this._validatePow = opts.validatePow !== undefined ? opts.validatePow : !!opts.validate
213-
this._validateBlocks = opts.validateBlocks !== undefined ? opts.validateBlocks : !!opts.validate
214221
this.ethash = this._validatePow ? new Ethash(this.db) : null
215222
this._heads = {}
216223
this._genesis = null

0 commit comments

Comments
 (0)