store: fix error handling around tipset key blocks

This commit is contained in:
vyzo 2022-11-11 05:07:09 +02:00
parent 9123628254
commit f438b1c7a6

View File

@ -647,14 +647,20 @@ func (cs *ChainStore) takeHeaviestTipSet(ctx context.Context, ts *types.TipSet)
if err := cs.writeHead(ctx, ts); err != nil {
log.Errorf("failed to write chain head: %s", err)
return nil
return err
}
tskBlk, err := ts.Key().ToStorageBlock()
if err != nil {
log.Errorf("failed to create a block from tsk: %s", ts.Key())
return err
}
err = cs.chainLocalBlockstore.Put(ctx, tskBlk)
if err != nil {
log.Errorf("failed to put block for tsk: %s", ts.Key())
return err
}
_ = cs.chainLocalBlockstore.Put(ctx, tskBlk)
return nil
}