swarm/network: hive bug: needed shallow peers are not sent to nodes beyond connection's proximity order (#19326)

* swarm/network: fix hive bug not sending shallow peers

-  hive bug: needed shallow peers were not sent to nodes beyond connection's proximity order
- add extensive protocol exchange tests for initial subPeersMsg-peersMsg exchange
- modify bzzProtocolTester to allow pregenerated overlay addresses

* swarm/network: attempt to fix hive persistance test

* swarm/network: fix TestHiveStatePersistance (#1320)

* swarm/network: remove trace lines from the hive persistance test

* address PR review comments

* swarm/network: address PR comments on TestInitialPeersMsg

 * eliminate *testing.T argument from bzz/hive protocoltesters
 * add sorting (only runs in test code) on peersMsg payload
 * add random (0 to MaxPeersPerPO) peers for each po
 * add extra peers closer to pivot than control
This commit is contained in:
Viktor Trón
2019-04-02 09:15:16 +02:00
committed by GitHub
parent 92faf1bf7a
commit 0529015091
5 changed files with 314 additions and 64 deletions

View File

@@ -20,6 +20,7 @@ import (
"context"
"errors"
"fmt"
"math/rand"
"sync"
"time"
@@ -37,6 +38,8 @@ const (
bzzHandshakeTimeout = 3000 * time.Millisecond
)
var DefaultTestNetworkID = rand.Uint64()
// BzzSpec is the spec of the generic swarm handshake
var BzzSpec = &protocols.Spec{
Name: "bzz",