mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 01:43:47 +00:00
whisper: test updated
This commit is contained in:
parent
7c660d3d84
commit
9f5d3f7d3e
1 changed files with 9 additions and 14 deletions
|
|
@ -98,7 +98,7 @@ var masterPow = 0.00000001
|
||||||
var round = 1
|
var round = 1
|
||||||
var debugMode = false
|
var debugMode = false
|
||||||
var prevTime time.Time
|
var prevTime time.Time
|
||||||
var c1prev, c2prev int
|
var cntPrev int
|
||||||
|
|
||||||
func TestSimulation(t *testing.T) {
|
func TestSimulation(t *testing.T) {
|
||||||
// create a chain of whisper nodes,
|
// create a chain of whisper nodes,
|
||||||
|
|
@ -328,28 +328,23 @@ func validateMail(t *testing.T, index int, mail []*ReceivedMessage) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkTestStatus() {
|
func checkTestStatus() {
|
||||||
var c1, c2 int
|
var cnt int
|
||||||
result.mutex.RLock()
|
var arr [NumNodes]int
|
||||||
defer result.mutex.RUnlock()
|
|
||||||
|
|
||||||
for i := 0; i < NumNodes; i++ {
|
|
||||||
if result.counter[i] > 0 {
|
|
||||||
c1++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for i := 0; i < NumNodes; i++ {
|
for i := 0; i < NumNodes; i++ {
|
||||||
|
arr[i] = nodes[i].server.PeerCount()
|
||||||
envelopes := nodes[i].shh.Envelopes()
|
envelopes := nodes[i].shh.Envelopes()
|
||||||
if len(envelopes) >= NumNodes {
|
if len(envelopes) >= NumNodes {
|
||||||
c2++
|
cnt++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if debugMode {
|
if debugMode {
|
||||||
if c1prev != c1 || c2prev != c2 {
|
if cntPrev != cnt {
|
||||||
fmt.Printf("\t %v number of nodes: received all msgs - %d, decrypted one msgs - %d \n", time.Since(prevTime), c2, c1)
|
fmt.Printf(" %v \t number of nodes that have received all msgs: %d, number of peers per node: %v \n",
|
||||||
|
time.Since(prevTime), cnt, arr)
|
||||||
prevTime = time.Now()
|
prevTime = time.Now()
|
||||||
c1prev, c2prev = c1, c2
|
cntPrev = cnt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue