log.WithField("module", logModule).Error("Chain connected notification is not a block")
break
}
-
+ m.status.BestHeight = block.Height
+ m.status.BestHash = block.Hash()
// Notify registered websocket clients of incoming block.
m.NotifyBlockConnected(block)
log.WithField("module", logModule).Error("Chain disconnected notification is not a block")
break
}
-
+ m.status.BestHeight = block.Height - 1
+ m.status.BestHash = block.PreviousBlockHash
// Notify registered websocket clients.
m.NotifyBlockDisconnected(block)
}
log.WithFields(log.Fields{"module": logModule, "err": err}).Error("blockNotify GetBlockByHash")
return
}
- m.updateStatus(block)
+
m.sendNotification(NTRawBlockDisconnected, block)
}
continue
}
- m.updateStatus(block)
m.sendNotification(NTRawBlockConnected, block)
}
m.wg.Done()
}
}
-func (m *WSNotificationManager) updateStatus(block *types.Block) {
- m.status.BestHeight = block.Height
- m.status.BestHash = block.Hash()
-}
-
// Start starts the goroutines required for the manager to queue and process websocket client notifications.
func (m *WSNotificationManager) Start() {
m.wg.Add(3)