MCPcopy Create free account
hub / github.com/ethstorage/es-node / getRandomU64InRange

Function getRandomU64InRange

ethstorage/p2p/protocol/sync_test.go:489–504  ·  view source on GitHub ↗
(excludedList map[uint64]struct{}, start, end, count uint64)

Source from the content-addressed store, hash-verified

487}
488
489func getRandomU64InRange(excludedList map[uint64]struct{}, start, end, count uint64) map[uint64]struct{} {
490 i := uint64(0)
491 m := make(map[uint64]struct{})
492 for i < count {
493 idx := rand.Uint64()%(end-start) + start
494 if _, ok := excludedList[idx]; ok {
495 continue
496 }
497 if _, ok := m[idx]; ok {
498 continue
499 }
500 m[idx] = struct{}{}
501 i++
502 }
503 return m
504}
505
506// TestSync_RequestL2Range test peer RequestBlobsByRange func and verify result
507func TestSync_RequestL2Range(t *testing.T) {

Callers 3

TestSyncWithExcludedListFunction · 0.85
TestAddPeerDuringSyncingFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected