Skip to content
This repository has been archived by the owner on May 19, 2023. It is now read-only.

Commit

Permalink
fix(core): use confirmation mechanism only when configured
Browse files Browse the repository at this point in the history
  • Loading branch information
AuHau committed Apr 23, 2020
1 parent 81919f9 commit fe34771
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/blockchain/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,18 @@ export abstract class BaseEventsEmitter extends AutoStartStopEventEmitter {
}

this.startEvents()
this.newBlockEmitter.on(NEW_BLOCK_EVENT_NAME, this.confirmEvents.bind(this))

if (this.confirmations > 0) {
this.newBlockEmitter.on(NEW_BLOCK_EVENT_NAME, this.confirmEvents.bind(this))
}
}

stop (): void {
this.stopEvents()
this.newBlockEmitter.off(NEW_BLOCK_EVENT_NAME, this.confirmEvents.bind(this))

if (this.confirmations > 0) {
this.newBlockEmitter.off(NEW_BLOCK_EVENT_NAME, this.confirmEvents.bind(this))
}
}

/**
Expand Down

0 comments on commit fe34771

Please sign in to comment.