diff --git a/storagemarket/impl/dtutils/dtutils.go b/storagemarket/impl/dtutils/dtutils.go index 91878f40..d36577e4 100644 --- a/storagemarket/impl/dtutils/dtutils.go +++ b/storagemarket/impl/dtutils/dtutils.go @@ -34,9 +34,14 @@ func ProviderDataTransferSubscriber(deals EventReceiver) datatransfer.Subscriber voucher, ok := channelState.Voucher().(*requestvalidation.StorageDataTransferVoucher) // if this event is for a transfer not related to storage, ignore if !ok { + log.Debugw("ignoring data-transfer event as it's not storage related", "event", datatransfer.Events[event.Code], "channelID", + channelState.ChannelID()) return } + log.Debugw("processing storage provider dt event", "event", datatransfer.Events[event.Code], "proposalCid", voucher.Proposal, "channelID", + channelState.ChannelID(), "channelState", datatransfer.Statuses[channelState.Status()]) + if channelState.Status() == datatransfer.Completed { err := deals.Send(voucher.Proposal, storagemarket.ProviderEventDataTransferCompleted) if err != nil { @@ -44,8 +49,6 @@ func ProviderDataTransferSubscriber(deals EventReceiver) datatransfer.Subscriber } } - log.Debugw("processing storage provider dt event", "event", datatransfer.Events[event.Code], "proposalCid", voucher.Proposal) - // Translate from data transfer events to provider FSM events // Note: We ignore data transfer progress events (they do not affect deal state) err := func() error { @@ -65,7 +68,8 @@ func ProviderDataTransferSubscriber(deals EventReceiver) datatransfer.Subscriber } }() if err != nil { - log.Errorf("processing dt event: %s", err) + log.Errorw("error processing storage provider dt event", "event", datatransfer.Events[event.Code], "proposalCid", voucher.Proposal, "channelID", + channelState.ChannelID(), "err", err) } } } @@ -82,6 +86,10 @@ func ClientDataTransferSubscriber(deals EventReceiver) datatransfer.Subscriber { return } + // Note: We ignore data transfer progress events (they do not affect deal state) + log.Debugw("processing storage client dt event", "event", datatransfer.Events[event.Code], "proposalCid", voucher.Proposal, "channelID", + channelState.ChannelID(), "channelState", datatransfer.Statuses[channelState.Status()]) + if channelState.Status() == datatransfer.Completed { err := deals.Send(voucher.Proposal, storagemarket.ClientEventDataTransferComplete) if err != nil { @@ -89,10 +97,6 @@ func ClientDataTransferSubscriber(deals EventReceiver) datatransfer.Subscriber { } } - // Translate from data transfer events to client FSM events - // Note: We ignore data transfer progress events (they do not affect deal state) - log.Debugw("processing storage client dt event", "event", datatransfer.Events[event.Code], "proposalCid", voucher.Proposal) - err := func() error { switch event.Code { case datatransfer.Cancel: @@ -112,7 +116,8 @@ func ClientDataTransferSubscriber(deals EventReceiver) datatransfer.Subscriber { } }() if err != nil { - log.Errorf("processing dt event: %s", err) + log.Errorw("error processing storage client dt event", "event", datatransfer.Events[event.Code], "proposalCid", voucher.Proposal, "channelID", + channelState.ChannelID(), "err", err) } } }