From b8bba15ed22c3303b2f4c593fde71a732f89f6e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 17 Dec 2020 11:53:11 +0100 Subject: [PATCH] markets: Fix deal expired panic --- markets/storageadapter/client.go | 2 +- markets/storageadapter/provider.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/markets/storageadapter/client.go b/markets/storageadapter/client.go index 4d00ab258..88a50931a 100644 --- a/markets/storageadapter/client.go +++ b/markets/storageadapter/client.go @@ -264,7 +264,7 @@ func (c *ClientNodeAdapter) OnDealExpiredOrSlashed(ctx context.Context, dealID a // and the chain has advanced to the confidence height stateChanged := func(ts *types.TipSet, ts2 *types.TipSet, states events.StateChange, h abi.ChainEpoch) (more bool, err error) { // Check if the deal has already expired - if sd.Proposal.EndEpoch <= ts2.Height() { + if ts2 == nil || sd.Proposal.EndEpoch <= ts2.Height() { onDealExpired(nil) return false, nil } diff --git a/markets/storageadapter/provider.go b/markets/storageadapter/provider.go index 79fd718f8..4ce32d2bf 100644 --- a/markets/storageadapter/provider.go +++ b/markets/storageadapter/provider.go @@ -344,7 +344,7 @@ func (n *ProviderNodeAdapter) OnDealExpiredOrSlashed(ctx context.Context, dealID // and the chain has advanced to the confidence height stateChanged := func(ts *types.TipSet, ts2 *types.TipSet, states events.StateChange, h abi.ChainEpoch) (more bool, err error) { // Check if the deal has already expired - if sd.Proposal.EndEpoch <= ts2.Height() { + if ts2 == nil || sd.Proposal.EndEpoch <= ts2.Height() { onDealExpired(nil) return false, nil }