From bf508c687d8ed9040e8c1f40037294d93d816cb1 Mon Sep 17 00:00:00 2001 From: Ingar Shu Date: Wed, 13 May 2020 14:26:21 -0700 Subject: [PATCH] Fix client-side manual transfer transitions --- storagemarket/impl/clientstates/client_fsm.go | 2 +- storagemarket/impl/clientstates/client_states.go | 7 +++++++ storagemarket/impl/providerutils/providerutils.go | 3 --- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/storagemarket/impl/clientstates/client_fsm.go b/storagemarket/impl/clientstates/client_fsm.go index 7ad4e1675..5efb7e8f6 100644 --- a/storagemarket/impl/clientstates/client_fsm.go +++ b/storagemarket/impl/clientstates/client_fsm.go @@ -68,7 +68,7 @@ var ClientEvents = fsm.Events{ fsm.Event(storagemarket.ClientEventDataTransferInitiated). From(storagemarket.StorageDealWaitingForDataRequest).To(storagemarket.StorageDealTransferring), fsm.Event(storagemarket.ClientEventDataTransferComplete). - From(storagemarket.StorageDealTransferring).To(storagemarket.StorageDealValidating), + FromMany(storagemarket.StorageDealTransferring, storagemarket.StorageDealWaitingForDataRequest).To(storagemarket.StorageDealValidating), fsm.Event(storagemarket.ClientEventResponseDealDidNotMatch). From(storagemarket.StorageDealValidating).To(storagemarket.StorageDealFailing). Action(func(deal *storagemarket.ClientDeal, responseCid cid.Cid, proposalCid cid.Cid) error { diff --git a/storagemarket/impl/clientstates/client_states.go b/storagemarket/impl/clientstates/client_states.go index e39587446..61a0c0ad3 100644 --- a/storagemarket/impl/clientstates/client_states.go +++ b/storagemarket/impl/clientstates/client_states.go @@ -111,6 +111,13 @@ func WaitingForDataRequest(ctx fsm.Context, environment ClientDealEnvironment, d return ctx.Trigger(storagemarket.ClientEventUnexpectedDealState, resp.Response.State) } + if deal.DataRef.TransferType == storagemarket.TTManual { + log.Infof("manual data transfer for deal %s", deal.ProposalCid) + + // Temporary, we will move to a query/response protocol to check on deal status + return ctx.Trigger(storagemarket.ClientEventDataTransferComplete) + } + log.Infof("sending data for a deal %s", deal.ProposalCid) // initiate a push data transfer. This will complete asynchronously and the diff --git a/storagemarket/impl/providerutils/providerutils.go b/storagemarket/impl/providerutils/providerutils.go index 501cb466e..8153fbeb4 100644 --- a/storagemarket/impl/providerutils/providerutils.go +++ b/storagemarket/impl/providerutils/providerutils.go @@ -9,7 +9,6 @@ import ( "github.com/filecoin-project/specs-actors/actors/builtin/market" "github.com/filecoin-project/specs-actors/actors/crypto" "github.com/ipfs/go-cid" - logging "github.com/ipfs/go-log/v2" "github.com/ipld/go-car" "github.com/ipld/go-ipld-prime" "golang.org/x/xerrors" @@ -20,8 +19,6 @@ import ( "github.com/filecoin-project/go-fil-markets/storagemarket/impl/blockrecorder" ) -var log = logging.Logger("storagemarket_impl") - // VerifyFunc is a function that can validate a signature for a given address and bytes type VerifyFunc func(context.Context, crypto.Signature, address.Address, []byte, shared.TipSetToken) (bool, error)