Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adding onValidated observer #1128

Merged
merged 10 commits into from
Aug 1, 2024
Prev Previous commit
Next Next commit
fix test
gabrielmer committed Aug 1, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 363dfddf305a6ebe79366b3cc64e086bd3daef14
9 changes: 6 additions & 3 deletions tests/pubsub/testgossipsub.nim
Original file line number Diff line number Diff line change
@@ -357,17 +357,20 @@ suite "GossipSub":
let
obs1 = PubSubObserver(
onRecv: proc(peer: PubSubPeer, msgs: var RPCMsg) =
inc observed,
onRecvAndValidated: proc(peer: PubSubPeer, msg: Message, msgId: MessageId) =
inc observed
)
obs2 = PubSubObserver(
onRecvAndValidated: proc(peer: PubSubPeer, msg: Message, msgId: MessageId) =
inc observed
)
obs3 = PubSubObserver(
onSend: proc(peer: PubSubPeer, msgs: var RPCMsg) =
inc observed
)

nodes[1].addObserver(obs1)
nodes[0].addObserver(obs2)
nodes[1].addObserver(obs2)
nodes[0].addObserver(obs3)

tryPublish await nodes[0].publish("foobar", "Hello!".toBytes()), 1