Skip to content

Commit

Permalink
vm, client: made VM.runBlockchain() return value backwards-compatible…
Browse files Browse the repository at this point in the history
… with Blockchain implemenations with an iterator void return value
  • Loading branch information
holgerd77 committed Jan 21, 2021
1 parent 52a2a47 commit 617d62f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/client/lib/sync/fullsync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class FullSynchronizer extends Synchronizer {
while (!newHead.equals(oldHead) && !this.stopSyncing) {
oldHead = newHead
this.vmPromise = this.vm.runBlockchain(this.vm.blockchain, 1)
const numExecuted = await this.vmPromise
const numExecuted = await this.vmPromise as number
if (numExecuted === 0) {
this.config.logger.warn(
`No blocks executed past chain head hash=${short(
Expand Down
2 changes: 1 addition & 1 deletion packages/vm/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ export default class VM extends AsyncEventEmitter {
*
* @param blockchain - An [@ethereumjs/blockchain](https://github.com/ethereumjs/ethereumjs-vm/tree/master/packages/blockchain) object to process
*/
async runBlockchain(blockchain?: Blockchain, maxBlocks?: number): Promise<number> {
async runBlockchain(blockchain?: Blockchain, maxBlocks?: number): Promise<void | number> {
await this.init()
return runBlockchain.bind(this)(blockchain, maxBlocks)
}
Expand Down
2 changes: 1 addition & 1 deletion packages/vm/lib/runBlockchain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default async function runBlockchain(
this: VM,
blockchain?: Blockchain,
maxBlocks?: number
): Promise<number> {
): Promise<void | number> {
let headBlock: Block
let parentState: Buffer

Expand Down

0 comments on commit 617d62f

Please sign in to comment.