@@ -53,18 +53,13 @@ func (k msgServer) RemoveX509Cert(goCtx context.Context, msg *types.MsgRemoveX50
53
53
// remove from subject with serialNumber map
54
54
k .RemoveUniqueCertificate (ctx , certBySerialNumber .Issuer , certBySerialNumber .SerialNumber )
55
55
56
- certs := types.ApprovedCertificates {
57
- Subject : msg .Subject ,
58
- SubjectKeyId : msg .SubjectKeyId ,
59
- Certs : certificates ,
60
- }
61
- k .removeCertFromList (certBySerialNumber .Issuer , certBySerialNumber .SerialNumber , & certs )
62
-
63
56
if foundApproved {
64
- k ._removeApprovedX509Cert (ctx , certID , certs )
57
+ removeCertFromList (certBySerialNumber .Issuer , certBySerialNumber .SerialNumber , & aprCerts .Certs )
58
+ k ._removeApprovedX509Cert (ctx , certID , & aprCerts , msg .SerialNumber )
65
59
}
66
60
if foundRevoked {
67
- k ._removeRevokedX509Cert (ctx , certID , certs )
61
+ removeCertFromList (certBySerialNumber .Issuer , certBySerialNumber .SerialNumber , & revCerts .Certs )
62
+ k ._removeRevokedX509Cert (ctx , certID , & revCerts )
68
63
}
69
64
} else {
70
65
k .RemoveApprovedCertificates (ctx , certID .Subject , certID .SubjectKeyId )
@@ -83,31 +78,24 @@ func (k msgServer) RemoveX509Cert(goCtx context.Context, msg *types.MsgRemoveX50
83
78
return & types.MsgRemoveX509CertResponse {}, nil
84
79
}
85
80
86
- func (k msgServer ) _removeApprovedX509Cert (ctx sdk.Context , certID types.CertificateIdentifier , certificates types.ApprovedCertificates ) {
81
+ func (k msgServer ) _removeApprovedX509Cert (ctx sdk.Context , certID types.CertificateIdentifier , certificates * types.ApprovedCertificates , serialNumber string ) {
87
82
if len (certificates .Certs ) == 0 {
88
83
k .RemoveApprovedCertificates (ctx , certID .Subject , certID .SubjectKeyId )
89
84
k .RemoveApprovedCertificateBySubject (ctx , certID .Subject , certID .SubjectKeyId )
90
85
k .RemoveApprovedCertificatesBySubjectKeyID (ctx , certID .Subject , certID .SubjectKeyId )
91
86
} else {
92
- k .SetApprovedCertificates (ctx , certificates )
93
- k .SetApprovedCertificatesBySubjectKeyID (
94
- ctx ,
95
- types.ApprovedCertificatesBySubjectKeyId {SubjectKeyId : certID .SubjectKeyId , Certs : certificates .Certs },
96
- )
87
+ k .SetApprovedCertificates (ctx , * certificates )
88
+ k .RemoveApprovedCertificatesBySubjectKeyIDAndSerialNumber (ctx , certID .Subject , certID .SubjectKeyId , serialNumber )
97
89
}
98
90
}
99
91
100
- func (k msgServer ) _removeRevokedX509Cert (ctx sdk.Context , certID types.CertificateIdentifier , certificates types.ApprovedCertificates ) {
92
+ func (k msgServer ) _removeRevokedX509Cert (ctx sdk.Context , certID types.CertificateIdentifier , certificates * types.RevokedCertificates ) {
101
93
if len (certificates .Certs ) == 0 {
102
94
k .RemoveRevokedCertificates (ctx , certID .Subject , certID .SubjectKeyId )
103
95
} else {
104
96
k .SetRevokedCertificates (
105
97
ctx ,
106
- types.RevokedCertificates {
107
- Subject : certID .Subject ,
108
- SubjectKeyId : certID .SubjectKeyId ,
109
- Certs : certificates .Certs ,
110
- },
98
+ * certificates ,
111
99
)
112
100
}
113
101
}
0 commit comments