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
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"database/sql"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
@ -94,6 +96,9 @@ func (s *Server) createProtocolStats(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
defer r.Body.Close()
|
||||
|
||||
peerIDHash := sha256.Sum256([]byte(protocolStats.PeerID))
|
||||
protocolStats.PeerID = hex.EncodeToString(peerIDHash[:])
|
||||
|
||||
if err := protocolStats.put(s.DB); err != nil {
|
||||
err := respondWithError(w, http.StatusInternalServerError, "Could not save protocol stats")
|
||||
if err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user