Fix lnurlpserver (#132)

* fix server

* go-lnurl v1.8.4

* encode

Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
This commit is contained in:
LightningTipBot 2021-11-15 01:12:52 +01:00 committed by GitHub
parent 8c4adb4dd4
commit 88bbd4d2cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,7 +3,6 @@ package lnurl
import (
"crypto/sha256"
"encoding/hex"
"encoding/json"
"fmt"
"net/http"
"net/url"
@ -193,11 +192,7 @@ func (w Server) serveLNURLpSecond(username string, amount int64, comment string)
// descriptionHash is the SHA256 hash of the metadata
func (w Server) descriptionHash(metadata lnurl.Metadata) (string, error) {
jsonMeta, err := json.Marshal(metadata)
if err != nil {
return "", err
}
hash := sha256.Sum256([]byte(string(jsonMeta)))
hash := sha256.Sum256([]byte(metadata.Encode()))
hashString := hex.EncodeToString(hash[:])
return hashString, nil
}