@@ -323,7 +323,7 @@ void CUDAMiner::search(
323
323
buffer.count = 0 ;
324
324
325
325
// Run the batch for this stream
326
- run_ethash_search (m_settings.gridSize , m_settings.blockSize , stream, &buffer, start_nonce, m_settings. parallelHash );
326
+ run_ethash_search (m_settings.gridSize , m_settings.blockSize , stream, &buffer, start_nonce);
327
327
}
328
328
329
329
// process stream batches until we get new work.
@@ -362,33 +362,43 @@ void CUDAMiner::search(
362
362
volatile Search_results& buffer (*m_search_buf[current_index]);
363
363
uint32_t found_count = std::min ((unsigned )buffer.count , MAX_SEARCH_RESULTS);
364
364
365
+ uint32_t gids[MAX_SEARCH_RESULTS];
366
+ h256 mixes[MAX_SEARCH_RESULTS];
367
+
365
368
if (found_count)
366
369
{
367
370
buffer.count = 0 ;
368
- uint64_t nonce_base = start_nonce - m_streams_batch_size;
369
371
370
372
// Extract solution and pass to higer level
371
373
// using io_service as dispatcher
372
374
373
375
for (uint32_t i = 0 ; i < found_count; i++)
374
376
{
375
- h256 mix;
376
- uint64_t nonce = nonce_base + buffer.result [i].gid ;
377
- memcpy (mix.data (), (void *)&buffer.result [i].mix , sizeof (buffer.result [i].mix ));
378
- auto sol = Solution{nonce, mix, w, std::chrono::steady_clock::now (), m_index};
379
-
380
- cudalog << EthWhite << " Job: " << w.header .abridged () << " Sol: "
381
- << toHex (sol.nonce , HexPrefix::Add) << EthReset;
382
-
383
- Farm::f ().submitProof (sol);
377
+ gids[i] = buffer.result [i].gid ;
378
+ memcpy (mixes[i].data (), (void *)&buffer.result [i].mix ,
379
+ sizeof (buffer.result [i].mix ));
384
380
}
385
381
}
386
382
387
383
// restart the stream on the next batch of nonces
388
384
// unless we are done for this round.
389
385
if (!done)
390
386
run_ethash_search (
391
- m_settings.gridSize , m_settings.blockSize , stream, &buffer, start_nonce, m_settings.parallelHash );
387
+ m_settings.gridSize , m_settings.blockSize , stream, &buffer, start_nonce);
388
+
389
+ if (found_count)
390
+ {
391
+ uint64_t nonce_base = start_nonce - m_streams_batch_size;
392
+ for (uint32_t i = 0 ; i < found_count; i++)
393
+ {
394
+ uint64_t nonce = nonce_base + gids[i];
395
+
396
+ Farm::f ().submitProof (
397
+ Solution{nonce, mixes[i], w, std::chrono::steady_clock::now (), m_index});
398
+ cudalog << EthWhite << " Job: " << w.header .abridged () << " Sol: 0x"
399
+ << toHex (nonce) << EthReset;
400
+ }
401
+ }
392
402
}
393
403
394
404
// Update the hash rate
0 commit comments