From c9c53c97459e569f9405e70be5cb720cbc03db24 Mon Sep 17 00:00:00 2001 From: vyzo Date: Thu, 10 Nov 2022 06:11:25 +0200 Subject: [PATCH] fix MinTimestap for null rounds --- chain/types/tipset.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/chain/types/tipset.go b/chain/types/tipset.go index cb981e0f01d..9d9e12f5762 100644 --- a/chain/types/tipset.go +++ b/chain/types/tipset.go @@ -196,8 +196,19 @@ func (ts *TipSet) MinTicket() *Ticket { } func (ts *TipSet) MinTimestamp() uint64 { - minTs := ts.Blocks()[0].Timestamp - for _, bh := range ts.Blocks()[1:] { + if ts == nil { + return 0 + } + + blks := ts.Blocks() + + if len(blks) == 0 { + // null rounds make things crash -- it is threaded in every fvm instantiation + return 0 + } + + minTs := blks[0].Timestamp + for _, bh := range blks[1:] { if bh.Timestamp < minTs { minTs = bh.Timestamp }