Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "refactor: pass deal proposal instead of deal ID to OnDealExpiredOrSlashed (#476)" #604

Merged
merged 1 commit into from
Aug 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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