Fix empty.tail exception occurring on chain block filter / filter headers callbacks (#5021)

* Fix empty.tail exception occurring on chain block filter / filter headers callbacks

* scalafmt
This commit is contained in:
Chris Stewart 2023-03-23 06:38:42 -05:00 committed by GitHub
parent e3e1c7f949
commit 6b03133a34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -112,7 +112,9 @@ object WebsocketUtil extends Logging {
val emitBlockProccessedWhileIBDOnGoing =
chainAppConfig.ibdBlockProcessedEvents
isIBDF.flatMap { isIBD =>
if (isIBD && !emitBlockProccessedWhileIBDOnGoing) {
if (
isIBD && !emitBlockProccessedWhileIBDOnGoing && filterHeaders.nonEmpty
) {
val notifications =
CompactFilterHeaderProcessedNotification(filterHeaders.last)
sendHeadersToWs(Vector(notifications), queue)
@ -130,7 +132,9 @@ object WebsocketUtil extends Logging {
val emitBlockProccessedWhileIBDOnGoing =
chainAppConfig.ibdBlockProcessedEvents
isIBDF.flatMap { isIBD =>
if (isIBD && !emitBlockProccessedWhileIBDOnGoing) {
if (
isIBD && !emitBlockProccessedWhileIBDOnGoing && filters.nonEmpty
) {
val notifications = CompactFilterProcessedNotification(filters.last)
sendHeadersToWs(Vector(notifications), queue)
} else {