Skip to content

Commit

Permalink
Disable write empty verifiedusername map
Browse files Browse the repository at this point in the history
  • Loading branch information
erwin.willems committed Apr 30, 2024
1 parent 3a79120 commit 2118216
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions routes/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,18 +260,18 @@ func (fes *APIServer) GetVerifiedUsernameToPKIDMapFromGlobalState() (_verificati
}
} else {
// Create the inital map structure
glog.Errorf("GetVerifiedUsernameToPKIDMapFromGlobalState: VerifiedMap is empty, creating a new one")
verifiedMapStruct.VerifiedUsernameToPKID = make(map[string]*lib.PKID)

// Encode the map and stick it in the database.
metadataDataBuf := bytes.NewBuffer([]byte{})
if err = gob.NewEncoder(metadataDataBuf).Encode(verifiedMapStruct); err != nil {
return nil, fmt.Errorf("GetVerifiedUsernameToPKIDMapFromGlobalState: cannot encode verifiedMap struct: %v", err)
}
err = fes.GlobalState.Put(_GlobalStatePrefixForVerifiedMap, metadataDataBuf.Bytes())
if err != nil {
return nil, fmt.Errorf("GetVerifiedUsernameToPKIDMapFromGlobalState: Cannot Decode Verification Map: %v", err)
}
// TODO: Disabled code below because it was causing a blank verifiedusername map. We should investigate why.
// metadataDataBuf := bytes.NewBuffer([]byte{})
// if err = gob.NewEncoder(metadataDataBuf).Encode(verifiedMapStruct); err != nil {
// return nil, fmt.Errorf("GetVerifiedUsernameToPKIDMapFromGlobalState: cannot encode verifiedMap struct: %v", err)
// }
// err = fes.GlobalState.Put(_GlobalStatePrefixForVerifiedMap, metadataDataBuf.Bytes())
// if err != nil {
// return nil, fmt.Errorf("GetVerifiedUsernameToPKIDMapFromGlobalState: Cannot Decode Verification Map: %v", err)
// }
}
// Return the verificationMap
return verifiedMapStruct.VerifiedUsernameToPKID, nil
Expand Down

0 comments on commit 2118216

Please sign in to comment.