Skip to content

Commit

Permalink
Revert "refactor: pass deal proposal instead of deal ID to OnDealExpi…
Browse files Browse the repository at this point in the history
…redOrSlashed (#476)" (#604)
  • Loading branch information
raulk authored Aug 16, 2021
1 parent 9859795 commit d3de422
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion storagemarket/impl/clientstates/client_states.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ func WaitForDealCompletion(ctx fsm.Context, environment ClientDealEnvironment, d
}
}

if err := node.OnDealExpiredOrSlashed(ctx.Context(), *deal.PublishMessage, deal.Proposal, expiredCb, slashedCb); err != nil {
if err := node.OnDealExpiredOrSlashed(ctx.Context(), deal.DealID, expiredCb, slashedCb); err != nil {
return ctx.Trigger(storagemarket.ClientEventDealCompletionFailed, err)
}

Expand Down
1 change: 0 additions & 1 deletion storagemarket/impl/clientstates/client_states_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,6 @@ func makeExecutor(ctx context.Context,
dealState, err := tut.MakeTestClientDeal(initialState, clientDealProposal, envParams.manualTransfer)
assert.NoError(t, err)
dealState.AddFundsCid = &tut.GenerateCids(1)[0]
dealState.PublishMessage = &tut.GenerateCids(1)[0]
dealState.FastRetrieval = dealParams.fastRetrieval
dealState.TransferChannelID = &datatransfer.ChannelID{}

Expand Down
2 changes: 1 addition & 1 deletion storagemarket/impl/providerstates/provider_states.go
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ func WaitForDealCompletion(ctx fsm.Context, environment ProviderDealEnvironment,
}
}

if err := node.OnDealExpiredOrSlashed(ctx.Context(), *deal.PublishCid, deal.Proposal, expiredCb, slashedCb); err != nil {
if err := node.OnDealExpiredOrSlashed(ctx.Context(), deal.DealID, expiredCb, slashedCb); err != nil {
return ctx.Trigger(storagemarket.ProviderEventDealCompletionFailed, err)
}

Expand Down
2 changes: 1 addition & 1 deletion storagemarket/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ type StorageCommon interface {
OnDealSectorCommitted(ctx context.Context, provider address.Address, dealID abi.DealID, sectorNumber abi.SectorNumber, proposal market.DealProposal, publishCid *cid.Cid, cb DealSectorCommittedCallback) error

// OnDealExpiredOrSlashed registers callbacks to be called when the deal expires or is slashed
OnDealExpiredOrSlashed(ctx context.Context, publishCid cid.Cid, proposal market.DealProposal, onDealExpired DealExpiredCallback, onDealSlashed DealSlashedCallback) error
OnDealExpiredOrSlashed(ctx context.Context, dealID abi.DealID, onDealExpired DealExpiredCallback, onDealSlashed DealSlashedCallback) error
}

// PackingResult returns information about how a deal was put into a sector
Expand Down
2 changes: 1 addition & 1 deletion storagemarket/testnodes/testnodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ func (n *FakeCommonNode) OnDealSectorCommitted(ctx context.Context, provider add
}

// OnDealExpiredOrSlashed simulates waiting for a deal to be expired or slashed, but provides stubbed behavior
func (n *FakeCommonNode) OnDealExpiredOrSlashed(ctx context.Context, publishCid cid.Cid, proposal market.DealProposal, onDealExpired storagemarket.DealExpiredCallback, onDealSlashed storagemarket.DealSlashedCallback) error {
func (n *FakeCommonNode) OnDealExpiredOrSlashed(ctx context.Context, dealID abi.DealID, onDealExpired storagemarket.DealExpiredCallback, onDealSlashed storagemarket.DealSlashedCallback) error {
if n.DelayFakeCommonNode.OnDealExpiredOrSlashed {
select {
case <-ctx.Done():
Expand Down

0 comments on commit d3de422

Please sign in to comment.