mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
swarm/pss: test updated (one peer added)
This commit is contained in:
parent
ad9e73482d
commit
c8d6458701
1 changed files with 4 additions and 4 deletions
|
|
@ -48,7 +48,7 @@ func TestForwardBasic(t *testing.T) {
|
||||||
base := pot.NewAddressFromBytes(baseAddrBytes)
|
base := pot.NewAddressFromBytes(baseAddrBytes)
|
||||||
var peerAddresses []pot.Address
|
var peerAddresses []pot.Address
|
||||||
var a pot.Address
|
var a pot.Address
|
||||||
const depth = 9
|
const depth = 10
|
||||||
for i := 0; i <= depth; i++ {
|
for i := 0; i <= depth; i++ {
|
||||||
// add one peer for each proximity order
|
// add one peer for each proximity order
|
||||||
a = pot.RandomAddressAt(base, i)
|
a = pot.RandomAddressAt(base, i)
|
||||||
|
|
@ -64,7 +64,7 @@ func TestForwardBasic(t *testing.T) {
|
||||||
ps := createPss(t, kad)
|
ps := createPss(t, kad)
|
||||||
addPeers(kad, peerAddresses)
|
addPeers(kad, peerAddresses)
|
||||||
|
|
||||||
const firstNearest = depth // first peer in the nearest neighbours' bin
|
const firstNearest = depth // shallowest peer in the nearest neighbours' bin
|
||||||
nearestNeighbours := []int{firstNearest, firstNearest + 1, firstNearest + 2}
|
nearestNeighbours := []int{firstNearest, firstNearest + 1, firstNearest + 2}
|
||||||
|
|
||||||
for i := 0; i < len(peerAddresses); i++ {
|
for i := 0; i < len(peerAddresses); i++ {
|
||||||
|
|
@ -104,12 +104,12 @@ func TestForwardBasic(t *testing.T) {
|
||||||
testForwardMsg(600+i, t, ps, peerAddresses[i][:part], peerAddresses, nearestNeighbours)
|
testForwardMsg(600+i, t, ps, peerAddresses[i][:part], peerAddresses, nearestNeighbours)
|
||||||
}
|
}
|
||||||
|
|
||||||
// partial address with proximity order higher than the last nearest neighbour
|
// partial address with proximity order deeper than any of the nearest neighbour
|
||||||
a = pot.RandomAddressAt(base, part)
|
a = pot.RandomAddressAt(base, part)
|
||||||
testForwardMsg(700, t, ps, a[:part], peerAddresses, nearestNeighbours)
|
testForwardMsg(700, t, ps, a[:part], peerAddresses, nearestNeighbours)
|
||||||
|
|
||||||
// special cases where partial address matches a large group of peers
|
// special cases where partial address matches a large group of peers
|
||||||
all := []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}
|
all := []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}
|
||||||
testForwardMsg(800, t, ps, []byte{}, peerAddresses, all)
|
testForwardMsg(800, t, ps, []byte{}, peerAddresses, all)
|
||||||
|
|
||||||
// luminous radius of one byte (8 bits)
|
// luminous radius of one byte (8 bits)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue