Fix inactivated NT's PC deletion problem in PCM
If a NT is inactivated and its PC is changed, the PC for the NT was not
removed during PCM.Update(). Fix the problem by handling deletion after
change.
@@ -51,21 +51,21 @@ func (m *proofContextMap) Update(src module.BTPProofContextMapUpdateSource) (mod
return nil, err
}
if btpSectionByBuilder, ok := btpSection.(*btpSectionByBuilder); ok {
- for _, ntid := range btpSectionByBuilder.inactivatedNTs {
- if _, ok := res.pcMap[ntid]; ok {
+ for _, nts_ := range btpSectionByBuilder.NetworkTypeSections() {
+ nts := nts_.(*networkTypeSectionByBuilder)
+ if nts.nsNPCChanged {
if res == m {
res = m.copy()
}
- delete(res.pcMap, ntid)
+ res.pcMap[nts.NetworkTypeID()] = nts.NextProofContext()
}
}
- for _, nts_ := range btpSectionByBuilder.NetworkTypeSections() {
- nts := nts_.(*networkTypeSectionByBuilder)
- if nts.nsNPCChanged {
+ for _, ntid := range btpSectionByBuilder.inactivatedNTs {
+ if _, ok := res.pcMap[ntid]; ok {
if res == m {
res = m.copy()
}
- res.pcMap[nts.NetworkTypeID()] = nts.NextProofContext()
+ delete(res.pcMap, ntid)
}
}
return res, nil
