Skip to content

Commit

Permalink
chore: downgrade to 1.19 for status-go
Browse files Browse the repository at this point in the history
  • Loading branch information
richard-ramos committed Jan 11, 2024
1 parent 5121e50 commit 9226a38
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/waku-org/go-waku

go 1.20
go 1.19

replace github.com/ethereum/go-ethereum v1.10.26 => github.com/status-im/go-ethereum v1.10.25-status.4

Expand Down
7 changes: 3 additions & 4 deletions waku/v2/node/wakunode2.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
golog "github.com/ipfs/go-log/v2"
"github.com/libp2p/go-libp2p"
"go.uber.org/zap"
"golang.org/x/exp/maps"

"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/p2p/enode"
Expand Down Expand Up @@ -325,13 +324,13 @@ func (w *WakuNode) watchMultiaddressChanges(ctx context.Context) {
case <-ctx.Done():
return
case <-first:
addr := maps.Keys(addrsSet)
addr := utils.MultiAddrFromSet(addrsSet)
w.log.Info("listening", logging.MultiAddrs("multiaddr", addr...))
case <-w.addressChangesSub.Out():
newAddrs := utils.MultiAddrSet(w.ListenAddresses()...)
if !maps.Equal(addrsSet, newAddrs) {
if !utils.MultiAddrSetEquals(addrsSet, newAddrs) {
addrsSet = newAddrs
addrs := maps.Keys(addrsSet)
addrs := utils.MultiAddrFromSet(addrsSet)
w.log.Info("listening addresses update received", logging.MultiAddrs("multiaddr", addrs...))
err := w.setupENR(ctx, addrs)
if err != nil {
Expand Down
23 changes: 23 additions & 0 deletions waku/v2/utils/multiaddr.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,26 @@ func MultiAddrSet(addr ...multiaddr.Multiaddr) map[multiaddr.Multiaddr]struct{}
}
return r
}

func MultiAddrSetEquals(m1 map[multiaddr.Multiaddr]struct{}, m2 map[multiaddr.Multiaddr]struct{}) bool {
if len(m1) != len(m2) {
return false
}

for k := range m1 {
_, ok := m2[k]
if !ok {
return false
}
}

return true
}

func MultiAddrFromSet(m map[multiaddr.Multiaddr]struct{}) []multiaddr.Multiaddr {
var r []multiaddr.Multiaddr
for k := range m {
r = append(r, k)
}
return r
}

0 comments on commit 9226a38

Please sign in to comment.