Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
p2p
go-p2p-pubsub
Commits
01041fa3
Commit
01041fa3
authored
Apr 23, 2020
by
vyzo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve reliability of star topology tests
Configure the star with 0 D, to act as a proper bootstrapper
parent
5397bb5a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
2 deletions
+26
-2
gossipsub_test.go
gossipsub_test.go
+26
-2
No files found.
gossipsub_test.go
View file @
01041fa3
...
...
@@ -948,17 +948,29 @@ func TestGossipsubStarTopology(t *testing.T) {
GossipSubDhi
=
GossipSubD
+
1
originalGossipSubDlo
:=
GossipSubDlo
GossipSubDlo
=
GossipSubD
-
1
originalGossipSubDscore
:=
GossipSubDscore
GossipSubDscore
=
GossipSubDlo
defer
func
()
{
GossipSubD
=
originalGossipSubD
GossipSubDhi
=
originalGossipSubDhi
GossipSubDlo
=
originalGossipSubDlo
GossipSubDscore
=
originalGossipSubDscore
}()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
hosts
:=
getNetHosts
(
t
,
ctx
,
20
)
psubs
:=
getGossipsubs
(
ctx
,
hosts
,
WithPeerExchange
(
true
))
psubs
:=
getGossipsubs
(
ctx
,
hosts
,
WithPeerExchange
(
true
),
WithFloodPublish
(
true
))
// configure the center of the star with a very low D
psubs
[
0
]
.
eval
<-
func
()
{
gs
:=
psubs
[
0
]
.
rt
.
(
*
GossipSubRouter
)
gs
.
D
=
0
gs
.
Dlo
=
0
gs
.
Dhi
=
0
gs
.
Dscore
=
0
}
// add all peer addresses to the peerstores
// this is necessary because we can't have signed address records witout identify
...
...
@@ -1020,17 +1032,29 @@ func TestGossipsubStarTopologyWithSignedPeerRecords(t *testing.T) {
GossipSubDhi
=
GossipSubD
+
1
originalGossipSubDlo
:=
GossipSubDlo
GossipSubDlo
=
GossipSubD
-
1
originalGossipSubDscore
:=
GossipSubDscore
GossipSubDscore
=
GossipSubDlo
defer
func
()
{
GossipSubD
=
originalGossipSubD
GossipSubDhi
=
originalGossipSubDhi
GossipSubDlo
=
originalGossipSubDlo
GossipSubDscore
=
originalGossipSubDscore
}()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
hosts
:=
getNetHosts
(
t
,
ctx
,
20
)
psubs
:=
getGossipsubs
(
ctx
,
hosts
,
WithPeerExchange
(
true
))
psubs
:=
getGossipsubs
(
ctx
,
hosts
,
WithPeerExchange
(
true
),
WithFloodPublish
(
true
))
// configure the center of the star with a very low D
psubs
[
0
]
.
eval
<-
func
()
{
gs
:=
psubs
[
0
]
.
rt
.
(
*
GossipSubRouter
)
gs
.
D
=
0
gs
.
Dlo
=
0
gs
.
Dhi
=
0
gs
.
Dscore
=
0
}
// manually create signed peer records for each host and add them to the
// peerstore of the center of the star, which is doing the bootstrapping
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment