mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
swarm/network/stream: fixed loop logic in retrieval tests
This commit is contained in:
parent
1b733c9553
commit
a2a1131a8b
1 changed files with 12 additions and 4 deletions
|
|
@ -205,6 +205,7 @@ func runFileRetrievalTest(nodeCount int) error {
|
||||||
// or until the timeout is reached.
|
// or until the timeout is reached.
|
||||||
allSuccess := false
|
allSuccess := false
|
||||||
for !allSuccess {
|
for !allSuccess {
|
||||||
|
allSuccess = true
|
||||||
for _, id := range nodeIDs {
|
for _, id := range nodeIDs {
|
||||||
//for each expected chunk, check if it is in the local store
|
//for each expected chunk, check if it is in the local store
|
||||||
localSuccess := true
|
localSuccess := true
|
||||||
|
|
@ -225,11 +226,14 @@ func runFileRetrievalTest(nodeCount int) error {
|
||||||
log.Debug(fmt.Sprintf("File with root hash %x successfully retrieved", hash))
|
log.Debug(fmt.Sprintf("File with root hash %x successfully retrieved", hash))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
allSuccess = localSuccess
|
if !localSuccess {
|
||||||
|
allSuccess = false
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !allSuccess {
|
if !allSuccess {
|
||||||
return fmt.Errorf("Not all chunks succeeded!")
|
return fmt.Errorf("Not all retrievals succeeded!")
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
@ -301,6 +305,7 @@ func runRetrievalTest(chunkCount int, nodeCount int) error {
|
||||||
// or until the timeout is reached.
|
// or until the timeout is reached.
|
||||||
allSuccess := false
|
allSuccess := false
|
||||||
for !allSuccess {
|
for !allSuccess {
|
||||||
|
allSuccess = true
|
||||||
for _, id := range nodeIDs {
|
for _, id := range nodeIDs {
|
||||||
//for each expected chunk, check if it is in the local store
|
//for each expected chunk, check if it is in the local store
|
||||||
localSuccess := true
|
localSuccess := true
|
||||||
|
|
@ -321,11 +326,14 @@ func runRetrievalTest(chunkCount int, nodeCount int) error {
|
||||||
log.Debug(fmt.Sprintf("File with root hash %x successfully retrieved", hash))
|
log.Debug(fmt.Sprintf("File with root hash %x successfully retrieved", hash))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
allSuccess = localSuccess
|
if !localSuccess {
|
||||||
|
allSuccess = false
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !allSuccess {
|
if !allSuccess {
|
||||||
return fmt.Errorf("Not all chunks succeeded!")
|
return fmt.Errorf("Not all retrievals succeeded!")
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue