mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 17:33:47 +00:00
whisper: timeout extended
This commit is contained in:
parent
0544a43c13
commit
c27671ee78
1 changed files with 9 additions and 11 deletions
|
|
@ -246,7 +246,7 @@ func checkPropagation(t *testing.T, includingNodeZero bool) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const cycle = 50
|
const cycle = 300
|
||||||
const iterations = 200
|
const iterations = 200
|
||||||
|
|
||||||
first := 0
|
first := 0
|
||||||
|
|
@ -262,9 +262,7 @@ func checkPropagation(t *testing.T, includingNodeZero bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
mail := f.Retrieve()
|
mail := f.Retrieve()
|
||||||
if !validateMail(t, i, mail) {
|
validateMail(t, i, mail)
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if isTestComplete() {
|
if isTestComplete() {
|
||||||
return
|
return
|
||||||
|
|
@ -274,17 +272,19 @@ func checkPropagation(t *testing.T, includingNodeZero bool) {
|
||||||
time.Sleep(cycle * time.Millisecond)
|
time.Sleep(cycle * time.Millisecond)
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Fatalf("Test was not complete: timeout %d seconds. nodes=%v", iterations*cycle/1000, nodes)
|
|
||||||
|
|
||||||
if !includingNodeZero {
|
if !includingNodeZero {
|
||||||
f := nodes[0].shh.GetFilter(nodes[0].filerID)
|
f := nodes[0].shh.GetFilter(nodes[0].filerID)
|
||||||
if f != nil {
|
if f != nil {
|
||||||
t.Fatalf("node zero received a message with low PoW.")
|
t.Fatalf("node zero received a message with low PoW.")
|
||||||
}
|
} else {
|
||||||
|
t.Fatalf("Test (second run) was not complete: timeout %d seconds. nodes=%v", iterations*cycle/1000, nodes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func validateMail(t *testing.T, index int, mail []*ReceivedMessage) bool {
|
t.Fatalf("Test (first run) was not complete: timeout %d seconds. nodes=%v", iterations*cycle/1000, nodes)
|
||||||
|
}
|
||||||
|
|
||||||
|
func validateMail(t *testing.T, index int, mail []*ReceivedMessage) {
|
||||||
var cnt int
|
var cnt int
|
||||||
for _, m := range mail {
|
for _, m := range mail {
|
||||||
if bytes.Equal(m.Payload, expectedMessage) {
|
if bytes.Equal(m.Payload, expectedMessage) {
|
||||||
|
|
@ -294,14 +294,13 @@ func validateMail(t *testing.T, index int, mail []*ReceivedMessage) bool {
|
||||||
|
|
||||||
if cnt == 0 {
|
if cnt == 0 {
|
||||||
// no messages received yet: nothing is wrong
|
// no messages received yet: nothing is wrong
|
||||||
return true
|
return
|
||||||
}
|
}
|
||||||
if cnt > 1 {
|
if cnt > 1 {
|
||||||
t.Fatalf("node %d received %d.", index, cnt)
|
t.Fatalf("node %d received %d.", index, cnt)
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if cnt > 0 {
|
if cnt == 1 {
|
||||||
result.mutex.Lock()
|
result.mutex.Lock()
|
||||||
defer result.mutex.Unlock()
|
defer result.mutex.Unlock()
|
||||||
result.counter[index] += cnt
|
result.counter[index] += cnt
|
||||||
|
|
@ -309,7 +308,6 @@ func validateMail(t *testing.T, index int, mail []*ReceivedMessage) bool {
|
||||||
t.Fatalf("node %d accumulated %d.", index, result.counter[index])
|
t.Fatalf("node %d accumulated %d.", index, result.counter[index])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func isTestComplete() bool {
|
func isTestComplete() bool {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue