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