dealpublisher: Fix provider address checks
This commit is contained in:
parent
2dc27d6ab4
commit
d0e87a7487
@ -114,9 +114,8 @@ func TestPublishDealsBatching(t *testing.T) {
|
||||
err = pubDealsParams.UnmarshalCBOR(bytes.NewReader(msg.Params))
|
||||
require.NoError(t, err)
|
||||
require.Len(t, pubDealsParams.Deals, int(maxDealsPerMsg))
|
||||
require.Equal(t, publisherKey.Address.String(), msg.From.String())
|
||||
}
|
||||
|
||||
require.Equal(t, publisherKey.Address.String(), msg.From.String())
|
||||
}
|
||||
require.Equal(t, 1, count)
|
||||
|
||||
|
@ -160,8 +160,16 @@ func (c *ClientNodeAdapter) ValidatePublishedDeal(ctx context.Context, deal stor
|
||||
return 0, xerrors.Errorf("failed to resolve from msg ID addr: %w", err)
|
||||
}
|
||||
|
||||
if fromid != mi.Worker {
|
||||
return 0, xerrors.Errorf("deal wasn't published by storage provider: from=%s, provider=%s", pubmsg.From, deal.Proposal.Provider)
|
||||
var pubOk bool
|
||||
pubAddrs := append([]address.Address{mi.Worker, mi.Owner}, mi.ControlAddresses...)
|
||||
for _, a := range pubAddrs {
|
||||
if fromid == a {
|
||||
pubOk = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !pubOk {
|
||||
return 0, xerrors.Errorf("deal wasn't published by storage provider: from=%s, provider=%s,%+v", pubmsg.From, deal.Proposal.Provider, pubAddrs)
|
||||
}
|
||||
|
||||
if pubmsg.To != miner2.StorageMarketActorAddr {
|
||||
|
Loading…
Reference in New Issue
Block a user