mirror of
https://github.com/waku-org/telemetry.git
synced 2025-02-12 16:06:23 +00:00
fix: hash peerID
This commit is contained in:
parent
855743e24c
commit
79db21455f
@ -1,7 +1,9 @@
|
|||||||
package telemetry
|
package telemetry
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"crypto/sha256"
|
||||||
"database/sql"
|
"database/sql"
|
||||||
|
"encoding/hex"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
@ -94,6 +96,9 @@ func (s *Server) createProtocolStats(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
defer r.Body.Close()
|
defer r.Body.Close()
|
||||||
|
|
||||||
|
peerIDHash := sha256.Sum256([]byte(protocolStats.PeerID))
|
||||||
|
protocolStats.PeerID = hex.EncodeToString(peerIDHash[:])
|
||||||
|
|
||||||
if err := protocolStats.put(s.DB); err != nil {
|
if err := protocolStats.put(s.DB); err != nil {
|
||||||
err := respondWithError(w, http.StatusInternalServerError, "Could not save protocol stats")
|
err := respondWithError(w, http.StatusInternalServerError, "Could not save protocol stats")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user