Skip to content

Commit 573421a

Browse files
committed
lint
1 parent ba1b513 commit 573421a

File tree

2 files changed

+33
-33
lines changed

2 files changed

+33
-33
lines changed

packages/blockchain/src/index.ts

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ const semaphore = require('semaphore')
2121

2222
// promisify a function: resolves this promise if callback is called
2323
function promisify(func: Function) {
24-
return function() {
24+
return function () {
2525
return new Promise((resolve, reject) => {
26-
func(function(err: any, value: any) {
26+
func(function (err: any, value: any) {
2727
if (err) {
2828
reject(err)
2929
} else {
@@ -269,19 +269,19 @@ export default class Blockchain implements BlockchainInterface {
269269
_init(cb: any): void {
270270
const self = this
271271
new Promise((resolve, reject) => {
272-
self._numberToHash(new BN(0), function(error: any, hash: any) {
272+
self._numberToHash(new BN(0), function (error: any, hash: any) {
273273
if (error) {
274274
reject(error)
275275
} else {
276276
resolve(hash)
277277
}
278278
})
279279
})
280-
.then(async function(hash) {
280+
.then(async function (hash) {
281281
await getHeads(hash)
282282
cb()
283283
})
284-
.catch(function(err) {
284+
.catch(function (err) {
285285
self._setCanonicalGenesisBlock((err?: any) => {
286286
if (err) {
287287
return cb(err)
@@ -409,7 +409,7 @@ export default class Blockchain implements BlockchainInterface {
409409
const self = this
410410
async function _putBlock(block: any): Promise<any> {
411411
return await new Promise((resolve, reject) => {
412-
self.putBlock(block, function(err: any, block: any) {
412+
self.putBlock(block, function (err: any, block: any) {
413413
resolve([err, block])
414414
})
415415
})
@@ -456,7 +456,7 @@ export default class Blockchain implements BlockchainInterface {
456456
const self = this
457457
async function _putHeader(block: any): Promise<any> {
458458
return await new Promise((resolve, reject) => {
459-
self.putHeader(block, function(err: any, block: any) {
459+
self.putHeader(block, function (err: any, block: any) {
460460
resolve([err, block])
461461
})
462462
})
@@ -533,9 +533,9 @@ export default class Blockchain implements BlockchainInterface {
533533
.then(promisify(getCurrentTd))
534534
.then(promisify(getBlockTd))
535535
.then(promisify(rebuildInfo))
536-
.then(function() {
536+
.then(function () {
537537
return new Promise((resolve, reject) => {
538-
self._batchDbOps(dbOps.concat(self._saveHeadOps()), function(err: any) {
538+
self._batchDbOps(dbOps.concat(self._saveHeadOps()), function (err: any) {
539539
if (err) {
540540
reject(err)
541541
} else {
@@ -544,10 +544,10 @@ export default class Blockchain implements BlockchainInterface {
544544
})
545545
})
546546
})
547-
.then(function() {
547+
.then(function () {
548548
cb()
549549
})
550-
.catch(function(err: any) {
550+
.catch(function (err: any) {
551551
cb(err)
552552
})
553553

@@ -584,10 +584,10 @@ export default class Blockchain implements BlockchainInterface {
584584
}
585585

586586
Promise.all([setTD(self._headHeader, 'header'), setTD(self._headBlock, 'block')])
587-
.then(function() {
587+
.then(function () {
588588
next()
589589
})
590-
.catch(function(err: any) {
590+
.catch(function (err: any) {
591591
next(err)
592592
})
593593
}
@@ -660,7 +660,7 @@ export default class Blockchain implements BlockchainInterface {
660660
// delete higher number assignments and overwrite stale canonical chain
661661
Promise.all([
662662
new Promise((resolve, reject) => {
663-
self._deleteStaleAssignments(number.iaddn(1), hash, dbOps, function(
663+
self._deleteStaleAssignments(number.iaddn(1), hash, dbOps, function (
664664
error: any,
665665
value: any,
666666
) {
@@ -672,7 +672,7 @@ export default class Blockchain implements BlockchainInterface {
672672
})
673673
}),
674674
new Promise((resolve, reject) => {
675-
self._rebuildCanonical(header, dbOps, function(error: any, value: any) {
675+
self._rebuildCanonical(header, dbOps, function (error: any, value: any) {
676676
if (error) {
677677
reject(error)
678678
} else {
@@ -681,10 +681,10 @@ export default class Blockchain implements BlockchainInterface {
681681
})
682682
}),
683683
])
684-
.then(function(value) {
684+
.then(function (value) {
685685
next(undefined, value)
686686
})
687-
.catch(function(error) {
687+
.catch(function (error) {
688688
next(error)
689689
})
690690
} else {
@@ -1005,9 +1005,9 @@ export default class Blockchain implements BlockchainInterface {
10051005
.then(promisify(checkCanonical))
10061006
.then(promisify(buildDBops))
10071007
.then(promisify(deleteStaleAssignments))
1008-
.then(function() {
1008+
.then(function () {
10091009
return new Promise((resolve, reject) => {
1010-
self._batchDbOps(dbOps, function(err: any) {
1010+
self._batchDbOps(dbOps, function (err: any) {
10111011
if (err) {
10121012
reject(err)
10131013
} else {
@@ -1016,10 +1016,10 @@ export default class Blockchain implements BlockchainInterface {
10161016
})
10171017
})
10181018
})
1019-
.then(function() {
1019+
.then(function () {
10201020
cb()
10211021
})
1022-
.catch(function(err: any) {
1022+
.catch(function (err: any) {
10231023
cb(err)
10241024
})
10251025

@@ -1146,7 +1146,7 @@ export default class Blockchain implements BlockchainInterface {
11461146
blockNumber = number.addn(1)
11471147
let error = false
11481148
while (blockNumber && !error) {
1149-
await run().catch(function(err: any) {
1149+
await run().catch(function (err: any) {
11501150
error = true
11511151
cb(err)
11521152
})
@@ -1162,10 +1162,10 @@ export default class Blockchain implements BlockchainInterface {
11621162

11631163
await promisify(getBlock)()
11641164
.then(promisify(runFunc))
1165-
.then(function() {
1165+
.then(function () {
11661166
blockNumber.iaddn(1)
11671167
})
1168-
.catch(function(error) {
1168+
.catch(function (error) {
11691169
blockNumber = false
11701170
if (error.type !== 'NotFoundError') {
11711171
throw error

packages/blockchain/test/index.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ test('blockchain test', (t) => {
1919
})
2020
})
2121

22-
t.test('should throw on initialization with chain and common parameter', async st => {
22+
t.test('should throw on initialization with chain and common parameter', async (st) => {
2323
st.plan(5)
2424
const common = new Common('ropsten')
2525

@@ -33,16 +33,16 @@ test('blockchain test', (t) => {
3333
let heads: any = []
3434

3535
let p0 = new Promise((resolve, reject) => {
36-
blockchain0.getHead(function(err?: any, head?: any) {
36+
blockchain0.getHead(function (err?: any, head?: any) {
3737
st.error(err, 'no error initializing with one parameter')
3838
resolve(head)
3939
})
40-
}).catch(function(err) {
40+
}).catch(function (err) {
4141
st.comment(err.message)
4242
})
4343

4444
let p1 = new Promise((resolve, reject) => {
45-
blockchain1.getHead(function(err?: any, head?: any) {
45+
blockchain1.getHead(function (err?: any, head?: any) {
4646
st.error(err, 'no error initializing with one parameter')
4747
resolve(head)
4848
})
@@ -652,7 +652,7 @@ test('blockchain test', (t) => {
652652
})
653653
})
654654

655-
t.test('uncached db ops', async st => {
655+
t.test('uncached db ops', async (st) => {
656656
st.plan(3) // explicitly let tape know we want to run 3 assertions in this test.
657657
createTestDB(async (err?: Error, db?: any, genesis?: Block) => {
658658
if (err) {
@@ -703,7 +703,7 @@ test('blockchain test', (t) => {
703703
})
704704
})
705705

706-
t.test('should save headers', st => {
706+
t.test('should save headers', (st) => {
707707
st.plan(2)
708708
const db = level()
709709
let blockchain = new Blockchain({ db: db, validateBlocks: true, validatePow: false })
@@ -767,7 +767,7 @@ test('blockchain test', (t) => {
767767
})
768768
})
769769

770-
t.test('immutable cached objects', st => {
770+
t.test('immutable cached objects', (st) => {
771771
st.plan(1)
772772
const blockchain = new Blockchain({ validateBlocks: true, validatePow: false })
773773
const genesisBlock = new Block()
@@ -818,7 +818,7 @@ test('blockchain test', (t) => {
818818
})
819819
})
820820

821-
t.test('should get latest', st => {
821+
t.test('should get latest', (st) => {
822822
st.plan(4)
823823
const blockchain = new Blockchain({ validateBlocks: true, validatePow: false })
824824
const headers = [new BlockHeader(), new BlockHeader()]
@@ -939,7 +939,7 @@ test('blockchain test', (t) => {
939939
})
940940
})
941941

942-
t.test('mismatched chains', async st => {
942+
t.test('mismatched chains', async (st) => {
943943
st.plan(2)
944944
const common = new Common('mainnet')
945945
const blockchain = new Blockchain({ common: common, validateBlocks: true, validatePow: false })

0 commit comments

Comments
 (0)