impl: only emit if range lengthy
@@ -77,12 +77,16 @@ export default class Listener extends EventEmitter {
h => h.number.toNumber() === blockNumber
)
+ if (justifiedHeaderIndex + 1 > this.offset) {
const reversedRange = this.headers
.slice(this.offset, justifiedHeaderIndex + 1)
.reverse()
this.offset = justifiedHeaderIndex + 1
-
+ Listener.debug(
+ 'reversedRange b4 shift',
+ reversedRange.map(h => h.number.toNumber())
+ )
const anchor = reversedRange.shift() as Header
this.emit(
@@ -93,6 +97,7 @@ export default class Listener extends EventEmitter {
justification
)
}
+ }
)
}
