(t *testing.T)
| 103 | } |
| 104 | |
| 105 | func 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 | |
| 131 | func TestEthashConcurrentSearch(t *testing.T) { |
| 132 | eth, err := NewForTesting() |
nothing calls this directly
no test coverage detected