add confidence check for indexed message epoch

This commit is contained in:
vyzo
2023-03-29 22:13:26 +02:00
committed by Maciej Witowski
parent 1151cb3754
commit 22490bdea9
+7
View File
@@ -179,6 +179,13 @@ func (sm *StateManager) searchForIndexedMsg(ctx context.Context, mcid cid.Cid, m
return nil, nil, cid.Undef, err
}
// check the height against the current tipset; minimum confidence requires that the inclusion
// tipset height is lower than the current head
curTs := sm.cs.GetHeaviestTipSet()
if curTs.Height() <= minfo.Epoch {
return nil, nil, cid.Undef, xerrors.Errorf("indexed message does not appear before the current tipset; index epoch: %d, current epoch: %d", minfo.Epoch, curTs.Height())
}
ts, err := sm.cs.GetTipSetByCid(ctx, minfo.TipSet)
if err != nil {
return nil, nil, cid.Undef, err