repair_eth: work better when messages are skipped

Otherwise there can be a nil pointer deref for polygon when it skips
the VAA.
This commit is contained in:
Jeff Schroeder 2022-05-10 09:02:49 -05:00 committed by Evan Gray
parent d266438654
commit e70830002e
1 changed files with 3 additions and 4 deletions

View File

@ -308,8 +308,8 @@ func main() {
log.Fatalf("failed to run find FindMissingMessages RPC: %v", err)
}
msgs := make([]*db.VAAID, len(resp.MissingMessages))
for i, id := range resp.MissingMessages {
msgs := []*db.VAAID{}
for _, id := range resp.MissingMessages {
fmt.Println(id)
vId, err := db.VaaIDFromString(id)
if err != nil {
@ -317,10 +317,9 @@ func main() {
}
if *vId == polygonIgnoredVaa {
log.Printf("Ignored message: %+v", &polygonIgnoredVaa)
msgs = append(msgs[:i], msgs[i+1:]...)
continue
}
msgs[i] = vId
msgs = append(msgs, vId)
}
if len(msgs) == 0 {