From f2550f9e360ccbe015a346800b8ba476edfb2ac6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 24 Oct 2019 17:56:32 +0200 Subject: [PATCH] on chain deals: Deal not found is not fatal --- chain/actors/actor_storagemarket.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/chain/actors/actor_storagemarket.go b/chain/actors/actor_storagemarket.go index 1d06feb06..57f7171a5 100644 --- a/chain/actors/actor_storagemarket.go +++ b/chain/actors/actor_storagemarket.go @@ -440,7 +440,10 @@ func (sma StorageMarketActor) ActivateStorageDeals(act *types.Actor, vmctx types for _, deal := range params.Deals { var dealInfo OnChainDeal if err := deals.Get(deal, &dealInfo); err != nil { - return nil, aerrors.HandleExternalError(err, "getting del info failed") + if _, is := err.(*amt.ErrNotFound); is { + return nil, aerrors.New(3, "deal not found") + } + return nil, aerrors.HandleExternalError(err, "getting deal info failed") } if vmctx.Message().From != dealInfo.Deal.Proposal.Provider { @@ -513,16 +516,19 @@ func (sma StorageMarketActor) ProcessStorageDealsPayment(act *types.Actor, vmctx for _, deal := range params.DealIDs { var dealInfo OnChainDeal if err := deals.Get(deal, &dealInfo); err != nil { + if _, is := err.(*amt.ErrNotFound); is { + return nil, aerrors.New(2, "deal not found") + } return nil, aerrors.HandleExternalError(err, "getting deal info failed") } if dealInfo.Deal.Proposal.Provider != vmctx.Message().From { - return nil, aerrors.New(1, "ProcessStorageDealsPayment can only be called by deal provider") + return nil, aerrors.New(3, "ProcessStorageDealsPayment can only be called by deal provider") } if vmctx.BlockHeight() < dealInfo.ActivationEpoch { // TODO: This is probably fatal - return nil, aerrors.New(1, "ActivationEpoch lower than block height") + return nil, aerrors.New(4, "ActivationEpoch lower than block height") } if vmctx.BlockHeight() > dealInfo.ActivationEpoch+dealInfo.Deal.Proposal.Duration {