Skip to content

Commit ba1b513

Browse files
jochem-brouwerevertonfraga
authored andcommitted
don't require the async package in runBlockchain
1 parent c528f0b commit ba1b513

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

packages/vm/lib/runBlockchain.ts

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import Blockchain from '@ethereumjs/blockchain'
22
import VM from './index'
3-
const async = require('async')
43
const callbackify = require('util-callbackify')
54

65
/**
@@ -25,7 +24,6 @@ export default function runBlockchain(this: VM, blockchain: Blockchain): Promise
2524

2625
function processBlock(block: any, reorg: boolean, cb: any) {
2726
async function _processBlock() {
28-
2927
// determine starting state for block run
3028
function getStartingState(cb: any) {
3129
// if we are just starting or if a chain re-org has happened
@@ -68,32 +66,35 @@ export default function runBlockchain(this: VM, blockchain: Blockchain): Promise
6866
})
6967
})
7068
}
71-
7269

73-
await new Promise((resolve, reject) => getStartingState(function(error: any) {
74-
if (error) {
75-
reject(error)
76-
} else {
77-
resolve()
78-
}
79-
}))
80-
.then(function () {
81-
return new Promise((resolve) => runBlock(function(error: any) {
70+
await new Promise((resolve, reject) =>
71+
getStartingState(function (error: any) {
8272
if (error) {
8373
reject(error)
8474
} else {
8575
resolve()
8676
}
87-
}))
88-
})
89-
.then(function() {
90-
cb()
91-
}).catch(function(error: any) {
92-
cb(error)
93-
})
77+
}),
78+
)
79+
.then(function () {
80+
return new Promise((resolve) =>
81+
runBlock(function (error: any) {
82+
if (error) {
83+
reject(error)
84+
} else {
85+
resolve()
86+
}
87+
}),
88+
)
89+
})
90+
.then(function () {
91+
cb()
92+
})
93+
.catch(function (error: any) {
94+
cb(error)
95+
})
9496
}
9597
_processBlock()
9698
}
97-
9899
})
99100
}

0 commit comments

Comments
 (0)