decode base64 for formatKeyID

json payload should be in base64 not hex
pull/541/head
jagdeep sidhu 2020-12-21 08:27:39 -08:00
parent 522b1eb647
commit 5bec4ec1e7
1 changed files with 4 additions and 5 deletions

View File

@ -596,13 +596,12 @@ func formatPercentage(a string) string {
}
func (s *PublicServer) formatKeyID(a string) string {
dst := make([]byte, hex.DecodedLen(len(a)))
_, errDecode := hex.Decode(dst, []byte(a))
if errDecode != nil {
glog.Error(errDecode)
keyBytes, err := base64.StdEncoding.DecodeString(a)
if err != nil {
glog.Error(err)
return ""
}
addr, err := s.chainParser.WitnessPubKeyHashFromKeyID(dst)
addr, err := s.chainParser.WitnessPubKeyHashFromKeyID(keyBytes)
if err != nil {
glog.Error(err)
return ""