|
9 | 9 |
|
10 | 10 | "github.com/zigbee-alliance/distributed-compliance-ledger/x/compliance/types" |
11 | 11 | dclauthtypes "github.com/zigbee-alliance/distributed-compliance-ledger/x/dclauth/types" |
12 | | - modeltypes "github.com/zigbee-alliance/distributed-compliance-ledger/x/model/types" |
13 | 12 | ) |
14 | 13 |
|
15 | 14 | func (k msgServer) ProvisionModel(goCtx context.Context, msg *types.MsgProvisionModel) (*types.MsgProvisionModelResponse, error) { |
@@ -46,16 +45,15 @@ func (k msgServer) ProvisionModel(goCtx context.Context, msg *types.MsgProvision |
46 | 45 |
|
47 | 46 | modelVersion, isFound := k.modelKeeper.GetModelVersion(ctx, msg.Vid, msg.Pid, msg.SoftwareVersion) |
48 | 47 |
|
49 | | - if !isFound { |
50 | | - return nil, modeltypes.NewErrModelVersionDoesNotExist(msg.Vid, msg.Pid, msg.SoftwareVersion) |
51 | | - } |
52 | | - |
53 | | - if modelVersion.SoftwareVersionString != msg.SoftwareVersionString { |
54 | | - return nil, types.NewErrModelVersionStringDoesNotMatch(msg.Vid, msg.Pid, msg.SoftwareVersion, msg.SoftwareVersionString) |
55 | | - } |
| 48 | + if isFound { |
| 49 | + // check if softwareVersionString matches with what is stored for the given version |
| 50 | + if modelVersion.SoftwareVersionString != msg.SoftwareVersionString { |
| 51 | + return nil, types.NewErrModelVersionStringDoesNotMatch(msg.Vid, msg.Pid, msg.SoftwareVersion, msg.SoftwareVersionString) |
| 52 | + } |
56 | 53 |
|
57 | | - if modelVersion.CdVersionNumber != int32(msg.CDVersionNumber) { |
58 | | - return nil, types.NewErrModelVersionCDVersionNumberDoesNotMatch(msg.Vid, msg.Pid, msg.SoftwareVersion, msg.CDVersionNumber) |
| 54 | + if modelVersion.CdVersionNumber != int32(msg.CDVersionNumber) { |
| 55 | + return nil, types.NewErrModelVersionCDVersionNumberDoesNotMatch(msg.Vid, msg.Pid, msg.SoftwareVersion, msg.CDVersionNumber) |
| 56 | + } |
59 | 57 | } |
60 | 58 |
|
61 | 59 | complianceInfo = types.ComplianceInfo{ |
|
0 commit comments