MCPcopy Create free account
hub / github.com/SmartPool/smartpool-client / TestEthashConcurrentVerify

Function TestEthashConcurrentVerify

ethereum/ethash/ethash_test.go:105–129  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

103}
104
105func TestEthashConcurrentVerify(t *testing.T) {
106 eth, err := NewForTesting()
107 if err != nil {
108 t.Fatal(err)
109 }
110 defer os.RemoveAll(eth.Full.Dir)
111
112 block := &testBlock{difficulty: big.NewInt(10)}
113 nonce, md := eth.Search(block, nil, 0)
114 block.nonce = nonce
115 block.mixDigest = common.BytesToHash(md)
116
117 // Verify the block concurrently to check for data races.
118 var wg sync.WaitGroup
119 wg.Add(100)
120 for i := 0; i < 100; i++ {
121 go func() {
122 if !eth.Verify(block) {
123 t.Error("Block could not be verified")
124 }
125 wg.Done()
126 }()
127 }
128 wg.Wait()
129}
130
131func TestEthashConcurrentSearch(t *testing.T) {
132 eth, err := NewForTesting()

Callers

nothing calls this directly

Calls 4

NewForTestingFunction · 0.85
SearchMethod · 0.80
VerifyMethod · 0.80
WaitMethod · 0.80

Tested by

no test coverage detected