|
|
@ -75,9 +75,8 @@ func (b *benchmarkBlockHeaders) init(h *serverHandler, count int) error { |
|
|
|
func (b *benchmarkBlockHeaders) request(peer *serverPeer, index int) error { |
|
|
|
func (b *benchmarkBlockHeaders) request(peer *serverPeer, index int) error { |
|
|
|
if b.byHash { |
|
|
|
if b.byHash { |
|
|
|
return peer.requestHeadersByHash(0, b.hashes[index], b.amount, b.skip, b.reverse) |
|
|
|
return peer.requestHeadersByHash(0, b.hashes[index], b.amount, b.skip, b.reverse) |
|
|
|
} else { |
|
|
|
|
|
|
|
return peer.requestHeadersByNumber(0, uint64(b.offset+rand.Int63n(b.randMax)), b.amount, b.skip, b.reverse) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return peer.requestHeadersByNumber(0, uint64(b.offset+rand.Int63n(b.randMax)), b.amount, b.skip, b.reverse) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// benchmarkBodiesOrReceipts implements requestBenchmark
|
|
|
|
// benchmarkBodiesOrReceipts implements requestBenchmark
|
|
|
@ -98,9 +97,8 @@ func (b *benchmarkBodiesOrReceipts) init(h *serverHandler, count int) error { |
|
|
|
func (b *benchmarkBodiesOrReceipts) request(peer *serverPeer, index int) error { |
|
|
|
func (b *benchmarkBodiesOrReceipts) request(peer *serverPeer, index int) error { |
|
|
|
if b.receipts { |
|
|
|
if b.receipts { |
|
|
|
return peer.requestReceipts(0, []common.Hash{b.hashes[index]}) |
|
|
|
return peer.requestReceipts(0, []common.Hash{b.hashes[index]}) |
|
|
|
} else { |
|
|
|
|
|
|
|
return peer.requestBodies(0, []common.Hash{b.hashes[index]}) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return peer.requestBodies(0, []common.Hash{b.hashes[index]}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// benchmarkProofsOrCode implements requestBenchmark
|
|
|
|
// benchmarkProofsOrCode implements requestBenchmark
|
|
|
@ -119,9 +117,8 @@ func (b *benchmarkProofsOrCode) request(peer *serverPeer, index int) error { |
|
|
|
rand.Read(key) |
|
|
|
rand.Read(key) |
|
|
|
if b.code { |
|
|
|
if b.code { |
|
|
|
return peer.requestCode(0, []CodeReq{{BHash: b.headHash, AccKey: key}}) |
|
|
|
return peer.requestCode(0, []CodeReq{{BHash: b.headHash, AccKey: key}}) |
|
|
|
} else { |
|
|
|
|
|
|
|
return peer.requestProofs(0, []ProofReq{{BHash: b.headHash, Key: key}}) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return peer.requestProofs(0, []ProofReq{{BHash: b.headHash, Key: key}}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// benchmarkHelperTrie implements requestBenchmark
|
|
|
|
// benchmarkHelperTrie implements requestBenchmark
|
|
|
|