@@ -93,7 +93,7 @@ export interface BlockchainOptions {
93
93
db ?: any
94
94
95
95
/**
96
- * This the flag indicates if blocks and Proof-of-Work should be validated. Defaults to true.
96
+ * This the flag indicates if blocks and Proof-of-Work should be validated.
97
97
* This option can't be used in conjunction with `validatePow` nor `validateBlocks`.
98
98
*
99
99
* @deprecated
@@ -102,13 +102,15 @@ export interface BlockchainOptions {
102
102
103
103
/**
104
104
* This flags indicates if Proof-of-work should be validated. If `validate` is provided, this
105
- * option takes its value.
105
+ * option takes its value. If neither `validate` nor this option are provided, it defaults to
106
+ * `true`.
106
107
*/
107
108
validatePow ?: boolean
108
109
109
110
/**
110
111
* This flags indicates if blocks should be validated. See Block#validate for details. If
111
- * `validate` is provided, this option takes its value.
112
+ * `validate` is provided, this option takes its value. If neither `validate` nor this option are
113
+ * provided, it defaults to `true`.
112
114
*/
113
115
validateBlocks ?: boolean
114
116
}
@@ -208,12 +210,12 @@ export default class Blockchain implements BlockchainInterface {
208
210
209
211
// defaults
210
212
211
- if ( opts . validate ) {
212
- this . _validatePow = true
213
- this . _validateBlocks = true
213
+ if ( opts . validate !== undefined ) {
214
+ this . _validatePow = opts . validate
215
+ this . _validateBlocks = opts . validate
214
216
} else {
215
- this . _validatePow = opts . validatePow !== undefined ? opts . validatePow : false
216
- this . _validateBlocks = opts . validateBlocks !== undefined ? opts . validateBlocks : false
217
+ this . _validatePow = opts . validatePow !== undefined ? opts . validatePow : true
218
+ this . _validateBlocks = opts . validateBlocks !== undefined ? opts . validateBlocks : true
217
219
}
218
220
219
221
this . db = opts . db ? opts . db : level ( )
0 commit comments