From 255a6b2010a4adf2f30a36a108b3f2b0eb9bc1db Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Tue, 28 May 2024 16:15:23 -0400 Subject: [PATCH] fix: insert peerID --- internal/persistence/database.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/persistence/database.go b/internal/persistence/database.go index 8ae2650..eeafc70 100644 --- a/internal/persistence/database.go +++ b/internal/persistence/database.go @@ -9,6 +9,7 @@ import ( "github.com/libp2p/go-libp2p/core/peer" "github.com/waku-org/go-waku/waku/v2/protocol/pb" "github.com/waku-org/go-waku/waku/v2/timesource" + "github.com/waku-org/go-waku/waku/v2/utils" "go.uber.org/zap" ) @@ -260,7 +261,7 @@ func (d *DBStore) RecordMessage(uuid string, tx *sql.Tx, msgHash pb.MessageHash, now := time.Now().UnixNano() for _, s := range storenodes { - _, err := stmt.Exec(uuid, clusterID, topic, msgHash.String(), timestamp, s.Addrs[0].String(), status, now) + _, err := stmt.Exec(uuid, clusterID, topic, msgHash.String(), timestamp, utils.EncapsulatePeerID(s.ID, s.Addrs[0])[0].String(), status, now) if err != nil { return err } @@ -277,7 +278,7 @@ func (d *DBStore) RecordStorenodeUnavailable(uuid string, storenode peer.AddrInf defer stmt.Close() now := time.Now().UnixNano() - _, err = stmt.Exec(uuid, storenode.Addrs[0].String(), now) + _, err = stmt.Exec(uuid, utils.EncapsulatePeerID(storenode.ID, storenode.Addrs[0])[0].String(), now) if err != nil { return err }