This repository was archived by the owner on Apr 6, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +5
-8
lines changed Expand file tree Collapse file tree 2 files changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -171,8 +171,7 @@ export default class Blockchain implements BlockchainInterface {
171
171
/**
172
172
* A flag indicating if this Blockchain validates blocks or not.
173
173
*/
174
- validate : boolean
175
-
174
+ public readonly validate : boolean
176
175
private readonly _validatePow : boolean
177
176
private readonly _validateBlocks : boolean
178
177
Original file line number Diff line number Diff line change @@ -12,11 +12,10 @@ const testData = require('./testdata.json')
12
12
13
13
test ( 'blockchain test' , function ( t ) {
14
14
t . plan ( 70 )
15
- const blockchain = new Blockchain ( )
15
+ const blockchain = new Blockchain ( { validate : false } )
16
16
let genesisBlock : any
17
17
const blocks : any [ ] = [ ]
18
18
let forkHeader : any
19
- blockchain . validate = false
20
19
async . series (
21
20
[
22
21
function ( done ) {
@@ -74,14 +73,14 @@ test('blockchain test', function(t) {
74
73
} )
75
74
} ,
76
75
function invalidGenesis ( done ) {
76
+ const blockchain = new Blockchain ( { validate : true } )
77
77
const badBlock = new Block ( )
78
78
badBlock . header . number = Buffer . from ( [ ] )
79
- blockchain . validate = true
79
+
80
80
blockchain . putBlock (
81
81
badBlock ,
82
82
function ( err ?: any ) {
83
83
t . ok ( err , 'should not validate a block incorrectly flagged as genesis' )
84
- blockchain . validate = false
85
84
done ( )
86
85
} ,
87
86
false ,
@@ -314,8 +313,7 @@ test('blockchain test', function(t) {
314
313
)
315
314
} ,
316
315
function iterateEmpty ( done ) {
317
- const blockchain = new Blockchain ( )
318
- blockchain . validate = false
316
+ const blockchain = new Blockchain ( { validate : false } )
319
317
blockchain . iterator (
320
318
'test' ,
321
319
function ( ) {
You can’t perform that action at this time.
0 commit comments