Skip to content

Commit

Permalink
fix MinTimestap for null rounds
Browse files Browse the repository at this point in the history
  • Loading branch information
vyzo committed Nov 10, 2022
1 parent 0ee9f9d commit c9c53c9
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions chain/types/tipset.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit c9c53c9

Please sign in to comment.