Added logging of events
This commit is contained in:
parent
731af19b08
commit
88ec29ecb2
3
bot.go
3
bot.go
|
@ -513,6 +513,7 @@ func main() {
|
|||
|
||||
switch event.Type {
|
||||
case utils2.JSONEventSideBlock:
|
||||
log.Printf("[SideBlock] On %s, id %s, height %d", e.Name, event.SideBlock.TemplateId, event.SideBlock.SideHeight)
|
||||
b := event.SideBlock
|
||||
e.Window[b.TemplateId] = b
|
||||
if !b.IsUncle() {
|
||||
|
@ -531,6 +532,7 @@ func main() {
|
|||
}
|
||||
e.pruneBlocks()
|
||||
case utils2.JSONEventFoundBlock:
|
||||
log.Printf("[FoundBlock] On %s, id %s, height %d", e.Name, event.FoundBlock.MainBlock.Id, event.FoundBlock.MainBlock.Height)
|
||||
e.PreviousBlocks = append(e.PreviousBlocks, event.FoundBlock)
|
||||
blockFound(e, event.FoundBlock, e.PreviousBlocks.GetPrevious(event.FoundBlock))
|
||||
|
||||
|
@ -552,6 +554,7 @@ func main() {
|
|||
e.PreviousBlocks = slices.Delete(e.PreviousBlocks, 0, 1)
|
||||
}
|
||||
case utils2.JSONEventOrphanedBlock:
|
||||
log.Printf("[OrphanedBlock] On %s, id %s, height %d, main id %s, main height %d", e.Name, event.SideBlock.TemplateId, event.SideBlock.SideHeight, event.SideBlock.MainId, event.SideBlock.MainHeight)
|
||||
if i := slices.IndexFunc(e.PreviousBlocks, func(block *index.FoundBlock) bool {
|
||||
return event.SideBlock.MainId == block.MainBlock.Id
|
||||
}); i != -1 {
|
||||
|
|
Loading…
Reference in a new issue