From efd5bb68eb6b00b98f3d1735e3c597e8cbdebf04 Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Tue, 20 Dec 2022 12:26:12 -0400 Subject: [PATCH] find msg --- go.mod | 2 +- go.sum | 2 ++ run.go | 20 ++++++++++++-------- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index 8df0a17..4371f8f 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/libp2p/go-libp2p v0.23.2 github.com/multiformats/go-multiaddr v0.7.0 github.com/status-im/status-go/eth-node v1.1.0 - github.com/waku-org/go-waku v0.2.3-test.0.20221214174409-f1fd8b354e8b + github.com/waku-org/go-waku v0.2.3-test.0.20221219232844-2c6d5cd7bdb2 ) require ( diff --git a/go.sum b/go.sum index 9730022..75f0473 100644 --- a/go.sum +++ b/go.sum @@ -1371,6 +1371,8 @@ github.com/waku-org/go-waku v0.2.3-test.0.20221209182808-d64c4aedc425 h1:2sQu7Pt github.com/waku-org/go-waku v0.2.3-test.0.20221209182808-d64c4aedc425/go.mod h1:MzmxeUFKOSGqI+3ditwJVmiDXtWW7p4vZhmFeAcwKyI= github.com/waku-org/go-waku v0.2.3-test.0.20221214174409-f1fd8b354e8b h1:nCqeKE6N9TmkhdyVjoq+1dpxOelXHBUilTVB8pat9ZI= github.com/waku-org/go-waku v0.2.3-test.0.20221214174409-f1fd8b354e8b/go.mod h1:/zvNHBJCSIw67oFdI8aLUPbeE6jGff6PK4ztx6Avct4= +github.com/waku-org/go-waku v0.2.3-test.0.20221219232844-2c6d5cd7bdb2 h1:lK2458FzFskWJrw/OHpLe7iqy38Xd8xPCElGlwu7ayY= +github.com/waku-org/go-waku v0.2.3-test.0.20221219232844-2c6d5cd7bdb2/go.mod h1:/zvNHBJCSIw67oFdI8aLUPbeE6jGff6PK4ztx6Avct4= github.com/wealdtech/go-ens/v3 v3.0.9/go.mod h1:P2OEBvgkhXLrPzPN+eR5z2/wFIGwHyijTDvpuC1xLlo= github.com/wealdtech/go-multicodec v1.2.0/go.mod h1:aedGMaTeYkIqi/KCPre1ho5rTb3hGpu/snBOS3GQLw4= github.com/wealdtech/go-string2eth v1.0.0/go.mod h1:UZA/snEybGcD6n+Pl+yoDjmexlEJ6dtoS9myfM83Ol4= diff --git a/run.go b/run.go index 7f4729e..e604c00 100644 --- a/run.go +++ b/run.go @@ -96,14 +96,14 @@ func queryNode(ctx context.Context, node string, host1 host.Host, s1 *store.Waku panic(err) } + fmt.Println("> Querying ", node) + messagesToLookFor := []string{ - "0x305b9f88bc8f670b57d895b06296a50eef8b69f1576bce7313d61c3fd4adf677", - "0x5336a19ad110eb5efaa39c180881529da490e3cc12b6f634d00a4105ed57da21", - "0x7554ffbeb8ec0373b165013708214ebda8103c9ff3d1bd676e0c1cd9b1a9571e", + "0x132599d05f9cffa8e1a9b3f2dfd08e65309892563c1f236e286cc884f7cd0da8", } - startDate := 1671058980 - endDate := 1671058980 + 120 + startDate := 1671224406 - int64(2*3600) // 2hr earlier + endDate := 1671224406 + int64(2*3600) // 2hr after messageExists, err := buildComparerFN(messagesToLookFor) if err != nil { @@ -126,8 +126,8 @@ func queryNode(ctx context.Context, node string, host1 host.Host, s1 *store.Waku result, err := s1.Query(ctx, store.Query{ Topic: "/waku/2/default-waku/proto", - StartTime: int64(time.Duration(startDate) * time.Second), - EndTime: int64((time.Duration(endDate) * time.Second)), + StartTime: startDate * int64(time.Second), + EndTime: endDate * int64(time.Second), }, store.WithPeer(info.ID), store.WithPaging(false, 100), store.WithRequestId([]byte{1, 2, 3, 4, 5, 6, 7, 8, byte(i)})) if err != nil { fmt.Printf("Could not query %s: %s", info.ID, err.Error()) @@ -141,11 +141,15 @@ func queryNode(ctx context.Context, node string, host1 host.Host, s1 *store.Waku for _, r := range result.Messages { h, _, _ := r.Hash() if messageExists(h) { - fmt.Println("Message found in", node) + fmt.Println("!!!!!!!!!!!!!! Message FOUND in", node) return } } + if len(result.Messages) > 0 { + fmt.Println("Iteration", cursorIterations, "Currently at", time.Unix(0, result.Messages[len(result.Messages)-1].Timestamp), len(result.Messages), "messages retrieved") + } + if result.IsComplete() { break }