|
|
@ -19,7 +19,7 @@ package les |
|
|
|
import ( |
|
|
|
import ( |
|
|
|
crand "crypto/rand" |
|
|
|
crand "crypto/rand" |
|
|
|
"encoding/binary" |
|
|
|
"encoding/binary" |
|
|
|
"fmt" |
|
|
|
"errors" |
|
|
|
"math/big" |
|
|
|
"math/big" |
|
|
|
"math/rand" |
|
|
|
"math/rand" |
|
|
|
"sync" |
|
|
|
"sync" |
|
|
@ -59,7 +59,7 @@ func (b *benchmarkBlockHeaders) init(h *serverHandler, count int) error { |
|
|
|
b.offset = 0 |
|
|
|
b.offset = 0 |
|
|
|
b.randMax = h.blockchain.CurrentHeader().Number.Int64() + 1 - d |
|
|
|
b.randMax = h.blockchain.CurrentHeader().Number.Int64() + 1 - d |
|
|
|
if b.randMax < 0 { |
|
|
|
if b.randMax < 0 { |
|
|
|
return fmt.Errorf("chain is too short") |
|
|
|
return errors.New("chain is too short") |
|
|
|
} |
|
|
|
} |
|
|
|
if b.reverse { |
|
|
|
if b.reverse { |
|
|
|
b.offset = d |
|
|
|
b.offset = d |
|
|
@ -137,7 +137,7 @@ func (b *benchmarkHelperTrie) init(h *serverHandler, count int) error { |
|
|
|
b.headNum = b.sectionCount*params.CHTFrequency - 1 |
|
|
|
b.headNum = b.sectionCount*params.CHTFrequency - 1 |
|
|
|
} |
|
|
|
} |
|
|
|
if b.sectionCount == 0 { |
|
|
|
if b.sectionCount == 0 { |
|
|
|
return fmt.Errorf("no processed sections available") |
|
|
|
return errors.New("no processed sections available") |
|
|
|
} |
|
|
|
} |
|
|
|
return nil |
|
|
|
return nil |
|
|
|
} |
|
|
|
} |
|
|
@ -338,7 +338,7 @@ func (h *serverHandler) measure(setup *benchmarkSetup, count int) error { |
|
|
|
case <-h.closeCh: |
|
|
|
case <-h.closeCh: |
|
|
|
clientPipe.Close() |
|
|
|
clientPipe.Close() |
|
|
|
serverPipe.Close() |
|
|
|
serverPipe.Close() |
|
|
|
return fmt.Errorf("Benchmark cancelled") |
|
|
|
return errors.New("Benchmark cancelled") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
setup.totalTime += time.Duration(mclock.Now() - start) |
|
|
|
setup.totalTime += time.Duration(mclock.Now() - start) |
|
|
|