@@ -93,10 +93,21 @@ export interface BlockchainOptions {
93
93
db ?: any
94
94
95
95
/**
96
- * This the flag indicates if blocks should be validated (e.g. Proof-of-Work), latest HF rules
97
- * supported: `Petersburg`.
96
+ * This the flag indicates if blocks and Proof-of-Work should be validated. Defaults to true.
97
+ * See
98
98
*/
99
99
validate ?: boolean
100
+
101
+ /**
102
+ * This flags indicates if Proof-of-work should be validated. Defaults to the value of `validate`.
103
+ */
104
+ validatePow ?: boolean
105
+
106
+ /**
107
+ * This flags indicates if blocks should be validated. See Block#validate for details. Defaults to
108
+ * the value of `validate`.
109
+ */
110
+ validateBlocks ?: boolean
100
111
}
101
112
102
113
/**
@@ -162,6 +173,9 @@ export default class Blockchain implements BlockchainInterface {
162
173
*/
163
174
validate : boolean
164
175
176
+ private readonly _validatePow : boolean
177
+ private readonly _validateBlocks : boolean
178
+
165
179
/**
166
180
* Creates new Blockchain object
167
181
*
@@ -183,6 +197,8 @@ export default class Blockchain implements BlockchainInterface {
183
197
this . db = opts . db ? opts . db : level ( )
184
198
this . dbManager = new DBManager ( this . db , this . _common )
185
199
this . validate = opts . validate === undefined ? true : opts . validate
200
+ this . _validatePow = opts . validatePow !== undefined ? opts . validatePow : this . validate
201
+ this . _validateBlocks = opts . validateBlocks !== undefined ? opts . validateBlocks : this . validate
186
202
this . ethash = this . validate ? new Ethash ( this . db ) : null
187
203
this . _heads = { }
188
204
this . _genesis = null
@@ -444,7 +460,7 @@ export default class Blockchain implements BlockchainInterface {
444
460
)
445
461
446
462
function verify ( next : any ) {
447
- if ( ! self . validate ) {
463
+ if ( ! self . _validateBlocks ) {
448
464
return next ( )
449
465
}
450
466
@@ -456,7 +472,7 @@ export default class Blockchain implements BlockchainInterface {
456
472
}
457
473
458
474
function verifyPOW ( next : any ) {
459
- if ( ! self . validate ) {
475
+ if ( ! self . _validatePow ) {
460
476
return next ( )
461
477
}
462
478
0 commit comments