1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-01 18:55:36 +00:00
Commit Graph

1108 Commits

Author SHA1 Message Date
Kano
be8cadbc46 Hotplug - allow setting interval via --hotplug or API 2013-03-04 17:26:11 +11:00
Kano
97cb77d18a curses - fix - put a dev_width inside #ifdef 2013-03-04 14:06:15 +11:00
Kano
e35e8ae135 Implement and use usb_cleanup() on shutdown or restart 2013-03-04 09:45:07 +11:00
Kano
c14f2ec642 API V1.25 - add 'Last Valid Work' time for each device 2013-03-03 19:33:20 +11:00
Kano
cc3869e5ce api -> drv 2013-03-03 16:38:02 +11:00
Con Kolivas
357294a70e Merge branch 'usb-dev' 2013-03-02 17:22:42 +11:00
Con Kolivas
2c3a946cf9 Update a pool's last work time when the work is popped as well as staged. 2013-03-02 16:01:37 +11:00
Con Kolivas
5c32a47b96 Merge pull request #375 from luke-jr/bugfix_cfgwrite_fnleak
Free filename entry for writing config file when done with it
2013-03-01 14:29:20 -08:00
Con Kolivas
52995e2811 Merge pull request #389 from kanoi/bflsc
BFL stop 1st init command if no device + Update diff stale: total and pools when stratum throws away shares
2013-03-01 14:28:02 -08:00
Kano
42a01e7b37 Update diff stale: total and pools when stratum throws away shares 2013-03-01 16:49:08 +11:00
Con Kolivas
b2b0d10a00 Merge branch 'master' into usb-dev 2013-02-28 23:37:06 +11:00
Con Kolivas
b4cac54a7e Keep stratum connections open for 2 minutes after the last work item was staged to allow stray shares to be submitted on pool switching. 2013-02-28 23:35:31 +11:00
Con Kolivas
5abcf06bbe Merge branch 'master' into usb-dev 2013-02-25 10:44:54 +11:00
Con Kolivas
d9d5a1a0b6 Speed up watchdog interval and therefore display updates to 2 seconds. 2013-02-25 10:43:47 +11:00
Con Kolivas
5a3b374962 Update copyright dates. 2013-02-25 08:59:11 +11:00
Con Kolivas
6bf79626b8 Merge branch 'master' into usb-dev 2013-02-23 13:59:37 +11:00
Con Kolivas
d16d4928f7 Fix --benchmark generating valid work for cgminer. 2013-02-22 21:41:47 +11:00
ckolivas
6a0882f05b Use the sessionid as passed on stratum connect to attempt to resume a connection once and then clear it if it fails, to use a new connection. 2013-02-22 16:55:39 +11:00
ckolivas
68d691093c Move to storing the nonce1 in the work struct instead of the sessionid for the now defunct first draft mining.resume protocol. 2013-02-22 12:55:01 +11:00
Con Kolivas
fce5434975 Add a get_queued function for devices to use to retrieve work items from the queued hashtable. 2013-02-18 14:14:10 +11:00
ckolivas
f910476daa Merge branch 'usb-dev' into queued_work 2013-02-17 00:10:59 +11:00
ckolivas
22a50a5a0f Merge branch 'usb-dev' of github.com:ckolivas/cgminer into usb-dev 2013-02-17 00:10:36 +11:00
Con Kolivas
4fdd45af6b Merge pull request #387 from luke-jr/bugfix_20130215b
Bugfix: Duplicate stratum sessionid when copying work, to avoid double-free
2013-02-16 03:51:33 -08:00
Luke Dashjr
0847d45867 Bugfix: Duplicate stratum sessionid when copying work, to avoid double-free 2013-02-16 06:46:00 +00:00
Con Kolivas
fda6d46e95 Add the choice of hash loop to the device driver, defaulting to hash_sole_work if none is specified. 2013-02-16 14:09:44 +11:00
Con Kolivas
254e25ac7f Add comments. 2013-02-16 14:03:40 +11:00
Con Kolivas
c80c65eac0 Add a driver specific flush_work for queued devices that may have work items already queued to abort working on them on the device and discard them. 2013-02-16 12:38:53 +11:00
Con Kolivas
294cda2eb2 Flush queued work on a restart from the hash database and discard the work structs. 2013-02-16 12:35:16 +11:00
Con Kolivas
e8e88beff1 Create a central point for removal of work items completed by queued device drivers. 2013-02-16 12:28:50 +11:00
Con Kolivas
95b2020263 Create a fill_queue function that creates hashtables of as many work items as is required by the device driver till it flags the queue full. 2013-02-16 12:14:13 +11:00
Con Kolivas
5e3253a7cf Create the hash queued work variant for use with devices that are fast enough to require a queue. 2013-02-16 11:54:05 +11:00
Con Kolivas
649f2939f7 Update copyright year. 2013-02-16 09:09:44 +11:00
Con Kolivas
0b83313161 Fix tv_lastupdate being made into tv_end and update the hashmeter on cycle, not opt_log_interval. 2013-02-16 09:08:19 +11:00
Con Kolivas
e414cd055c Fix tv_lastupdate being made into tv_end and update the hashmeter on cycle, not opt_log_interval. 2013-02-16 09:07:33 +11:00
Con Kolivas
ab0cc58cb4 Merge branch 'master' into usb-dev 2013-02-15 23:15:11 +11:00
Con Kolivas
0f7ab3670c Only continue submitting shares with mining.resume support on stratum when the session id matches. 2013-02-15 23:11:13 +11:00
Con Kolivas
be4705a003 Provide support for mining.resume with stratum, currently re-authorising after successful resumption pending finalising of the protocol process. 2013-02-15 23:05:29 +11:00
Con Kolivas
4cde791e9f Provide basic framework for restarting stratum depending on whether resume support exists or not. 2013-02-15 21:31:44 +11:00
Con Kolivas
16c7c983ae Free sessionid in clean_work and remove redundant setting of strings to NULL since the whole work struct is zeroed. 2013-02-15 20:27:07 +11:00
Con Kolivas
8fdf6d5c64 Only clear stratum shares mandatorily on stratum dropouts when the pool does not support resume. 2013-02-15 18:34:54 +11:00
Con Kolivas
f60637c3f9 Try resubmitting stratum shares every 5 seconds for up to 2 minutes if the pool session id exists and matches on failure to submit. 2013-02-15 17:48:13 +11:00
Con Kolivas
7e8019acdd Do as much outside of mutex locking of sshare_lock as possible. 2013-02-15 16:13:24 +11:00
Con Kolivas
7551b88d00 Remove last reference to struct work used outside the sshare_lock in submit_work_thread 2013-02-15 16:09:36 +11:00
Con Kolivas
ebb99e5a8d Unlock the sshare_lock in submit_work_thread when all references to work and sshare are complete. 2013-02-15 16:05:21 +11:00
Con Kolivas
1bf1f4a217 Add timestamps to stratum_share structs as they're generated and copy the stratum sessionid if it exists to stratum work generated. 2013-02-15 15:36:29 +11:00
Con Kolivas
20b5ebbc95 hash_sole_work can be static 2013-02-11 15:28:41 +11:00
Con Kolivas
c28e2238c6 Merge branch 'master' into usb-dev 2013-02-10 13:29:25 +11:00
Con Kolivas
775a1abc06 Keep the unique id of each work item across copy_work to prevent multiple work items having the same id. 2013-02-10 13:28:06 +11:00
Con Kolivas
61a3e1b1d1 Merge pull request #382 from kanoi/hotplug
USB tidy up requests + Hotplug
2013-02-09 02:36:27 -08:00
Con Kolivas
dafc2f775a Abstract out the main hashing loop to allow us to use a separate loop for devices that are fast enough to require queued work. 2013-02-09 21:12:03 +11:00
Con Kolivas
81b84d4f7b Provide a noop thread_enable function for drivers that don't support it. 2013-02-09 19:59:36 +11:00
Con Kolivas
b884d11a23 Provide a noop thread_shutdown function for drivers that don't support it. 2013-02-09 19:56:45 +11:00
Con Kolivas
2c28eefc45 Provide a noop hw_error function for drivers that don't support it. 2013-02-09 19:54:54 +11:00
Con Kolivas
210537198c Provide a noop prepare_work for drivers that don't support it. 2013-02-09 19:52:00 +11:00
Con Kolivas
b9f5b48c08 Provide a noop thread_init for drivers that don't support it. 2013-02-09 19:50:07 +11:00
Con Kolivas
8e12a05b47 Provide a noop can_limit_work for devices that don't support it. 2013-02-09 19:48:11 +11:00
Con Kolivas
5b22f092d9 Provide a noop thread_prepare function for drivers that don't use thread_prepare. 2013-02-09 19:36:38 +11:00
Con Kolivas
5d581cb5d7 Use blank_get_statline_before for GPU devices that don't support adl monitoring. 2013-02-09 19:27:57 +11:00
Con Kolivas
2c3c9e5b55 Provide a noop get_stats function for drivers that don't support it. 2013-02-09 19:25:24 +11:00
Con Kolivas
de48ccca0e Provide a blank get_statline for drivers that don't support it. 2013-02-09 19:22:13 +11:00
Con Kolivas
b3d9477eb7 Provide a blank get_statline_before function for drivers that don't have one. 2013-02-09 18:18:52 +11:00
Con Kolivas
f2380eab4c Fill drivers missing reinit_device with a noop version. 2013-02-09 15:10:10 +11:00
Kano
530e3b0172 hotplug use get_thread() where appropriate 2013-02-08 02:38:37 +11:00
Kano
6fb32f7b5d convert sleep(const) to nmsleep() 2013-02-08 02:32:27 +11:00
Kano
bc5755233c call a separate get_devices() with locking, as required 2013-02-08 02:12:09 +11:00
Kano
983fe2b0c0 usbutils hotplug v0.1 2013-02-08 01:42:36 +11:00
Kano
296eab26b4 Report USB nodev as ZOMBIE on the screen 2013-02-08 01:34:48 +11:00
Con Kolivas
3c91b292a2 Merge branch 'master' into usb-dev 2013-02-07 18:02:38 +11:00
Con Kolivas
3804850141 Do not consider every call to stratum_resumed a pool recovery unless it was actually idle. 2013-02-07 13:51:54 +11:00
Con Kolivas
03dff61e54 Merge branch 'master' into usb-dev 2013-02-05 22:00:23 +11:00
Con Kolivas
73b7d7b0c9 Do not enable the pool disable on reject feature unless explicitly enabled with --disable-rejecting. 2013-02-05 21:47:26 +11:00
Con Kolivas
5c1f3b36d6 Merge branch 'master' into usb-dev 2013-02-05 21:34:58 +11:00
Kano
f52f02e9b7 Stratum disconnect shares - count total against stale 2013-02-05 21:34:39 +11:00
Con Kolivas
ffdcaed49d Use sanity checking to prevent a possible overflow with invalid data being given by the pool for difficulty as reported by luke-Jr. 2013-02-05 21:10:18 +11:00
Con Kolivas
0244998ef8 Merge branch 'master' into usb-dev 2013-02-04 11:23:20 +11:00
Con Kolivas
81025611ac Check for calloc failure for completeness in gen_stratum_work. 2013-02-04 11:22:08 +11:00
Con Kolivas
d644fdf1f4 Cache the coinbase length to speed up stratum work generation. 2013-02-04 11:19:12 +11:00
Con Kolivas
0870ab7532 Cache the header length when generating stratum work to avoid calculating it on every work generation, and to only need one alloc+sprintf, speeding up work generation. 2013-02-04 11:06:05 +11:00
Con Kolivas
5402941691 Use heap ram for coinbase in gen_stratum_work, zeroing it before use. 2013-02-04 10:22:10 +11:00
Con Kolivas
51d11a28f9 Provide a wrapper for aligning lengths of size_t to 4 byte boundaries. 2013-02-04 10:19:12 +11:00
Con Kolivas
5d122cad93 Provide wrappers for grabbing of thr value under the mining_thr_lock. 2013-02-03 23:41:41 +11:00
Con Kolivas
08ece33f7e Merge branch 'master' of https://github.com/kanoi/cgminer into kanoi-usb 2013-02-03 22:51:51 +11:00
Kano
7abf30b2c0 distinguish between drv and it's id enum now called drv_id 2013-02-03 22:51:05 +11:00
Con Kolivas
70b5b84052 Merge branch 'master' of https://github.com/kanoi/cgminer into kanoi-usb 2013-02-03 21:33:12 +11:00
Kano
61ec1fe91f mutex all access to mining_thr 2013-02-02 20:14:55 +11:00
Kano
212f32e5e0 Split thr_info array into control_thr and mining_thr pointers so more mining threads can be added later 2013-02-02 20:14:53 +11:00
Kano
7388942bbd Stratum disconnect shares - count total against stale 2013-02-02 20:14:45 +11:00
Kano
0b3d8c89c2 API zero - zero statistics - all or bestshare - with optional on screen summary 2013-02-02 20:14:27 +11:00
Kano
bad942e59a increase device status string length 2013-02-02 20:14:24 +11:00
Kano
f9e04a3c5b device_drv - allow .name to be changed before add_cgpu() 2013-02-02 20:14:23 +11:00
Kano
a4e95cfa42 device_drv missing drv for cpu and incorrect test 2013-02-02 20:14:20 +11:00
Kano
a344deb6ac rename device_api -> device_drv and all related api -> drv and add a device_drv->drv enum for identifying which driver each is 2013-02-02 20:14:19 +11:00
Kano
7724989d9b diffexactone pool diff1 used for share value calculation is ffffffff... not 100000000... :P 2013-02-02 20:14:17 +11:00
Con Kolivas
7e2b1e80aa Fix memory leak on stratum share submission. 2013-02-02 11:47:25 +11:00
Kano
4c2f26e280 zero (most) API stats 2013-01-02 22:34:05 +11:00
Kano
03f626e68d Remember best share per pool and return in API pools 2013-01-02 21:51:09 +11:00
Con Kolivas
ec9b32aac0 Zero the best share string memory when zeroing stats. 2012-12-31 09:15:17 +11:00
Con Kolivas
6e2e7d36de Differentiate socket full from sock full. 2012-12-29 10:46:55 +11:00
Con Kolivas
7f46f6e91f Allow stratum to startup without notify but check it is valid before creating stratum work. 2012-12-29 10:42:45 +11:00
Con Kolivas
e1d7ecdd35 Do not try to generate stratum work unless the notify command has succeeded. 2012-12-29 09:45:40 +11:00
Con Kolivas
34a6c59a92 Reset total diff1 shares when zeroing stats as well to show correct work utility. 2012-12-27 09:49:22 +11:00
Con Kolivas
8958ee424b Do not give the share submission failure message on planned stratum disconnects. 2012-12-26 09:38:58 +11:00
Con Kolivas
944af31b99 Parse anything in the stratum socket if it's full without waiting. Empty the socket even if a connection is not needed in case there are share returns. 2012-12-26 09:31:41 +11:00
Con Kolivas
dd4e51594b Provide a mechanism to zero all the statistics from the menu. 2012-12-25 23:44:26 +11:00
Con Kolivas
d3bfee14b3 Display the current pool diff in the status line. 2012-12-25 23:14:21 +11:00
Con Kolivas
fedf0f11e4 Display block diff in status line. 2012-12-25 14:53:44 +11:00
Con Kolivas
98151b2ee4 Generalise the code for solving a block to enable block solve detection with scrypt mining. 2012-12-25 14:36:08 +11:00
Con Kolivas
f0c1782c03 Generate the output hash for scrypt as well and use the one function to set share_diff. 2012-12-25 14:08:27 +11:00
Con Kolivas
f86e893118 Use the flip80 function in regeneratehash and the correct sized hash array. 2012-12-24 14:13:28 +11:00
Con Kolivas
93e3c16aa8 Stage work outside of the stgd lock to prevent attempted recursive locking in clone_available. 2012-12-24 13:49:28 +11:00
Con Kolivas
34879487fc share_diff needs to be performed on a BE version of the output hash to work, leading to false best_share values as spotted by luke-Jr. 2012-12-24 13:31:45 +11:00
Con Kolivas
deb9aec0ed Remove the unused sha224 functions. 2012-12-24 12:54:09 +11:00
Con Kolivas
432bfd0e5c Use the flip functions in hashtest. 2012-12-24 12:39:27 +11:00
Con Kolivas
54e218b6d4 Simplify the setting of the nonce data field in work on submitting nonces. 2012-12-24 11:19:33 +11:00
Con Kolivas
69dd5affe3 Scrypt code does not enter the hashtest function. 2012-12-24 10:45:57 +11:00
ckolivas
9fd60bb53a Merge branch 'master' of github.com:ckolivas/cgminer 2012-12-24 10:34:06 +11:00
Con Kolivas
df7370d066 Go back to cloning available work under staged lock. 2012-12-24 10:26:56 +11:00
ckolivas
d91dc188d2 scrypt_diff uses a uint64_t as well. 2012-12-23 15:44:43 +11:00
Con Kolivas
bb64799c84 Correct target for stratum support with scrypt mining. 2012-12-22 08:37:43 +11:00
Con Kolivas
b9c7f3d169 Remove debugging message :P 2012-12-19 21:31:22 +11:00
Con Kolivas
a07e0155bc Stop all work from the current pool if it's a stratum pool once it is disconnected since it will be invalid upon reconnecting. 2012-12-19 20:53:11 +11:00
Con Kolivas
8dbb3fa2f9 Discard all staged work from stratum pools as well as the shares upon disconnection since all the work becomes invalid. 2012-12-19 20:51:22 +11:00
Con Kolivas
a7128e008f Use correct cbreak after 15 second delay when no pool is found alive. 2012-12-19 20:21:32 +11:00
Con Kolivas
4f1f5c8ec9 Revert "Reset lagging flag after it has been used in the getwork scheduler."
This reverts commit 19267907c0.

Redundant.
2012-12-19 20:04:22 +11:00
ckolivas
19267907c0 Reset lagging flag after it has been used in the getwork scheduler. 2012-12-19 14:41:42 +11:00
ckolivas
14457a0b9b Allow stratum to work with scrypt. 2012-12-19 14:41:29 +11:00
Con Kolivas
3b910336ce Protect the best_share/best_diff values under control lock. 2012-12-18 22:48:56 +11:00
Con Kolivas
9ef73d9300 Check a stratum pool hasn't gone dead while being a backup pool and missed having its idle flag cleared. 2012-12-17 12:27:50 +11:00
Kano
43e8b88a73 Benchmark incorrect work size 2012-12-12 19:52:36 +11:00
Con Kolivas
e51ee93182 Set tv_idle time if a pool is not active when input from the menu. 2012-12-10 21:25:17 +11:00
Con Kolivas
70b6287627 Merge pull request #354 from kanoi/api
minor unlikely zero pointer test
2012-12-09 23:58:54 -08:00
Kano
58a7226d96 minor unlikely zero pointer test 2012-12-10 18:42:32 +11:00
Con Kolivas
c3fb1bcef5 Revert "Selectively discard all work items if a longpoll or stratum restart is received without a new block to work on."
This reverts commit 31f75098b5.

Mistake, set in work_block already.
2012-12-10 15:40:16 +11:00
Con Kolivas
1922e498e3 Only stratum pools that are idle need to be kicked via cnx_needed. 2012-12-10 11:03:50 +11:00
Con Kolivas
c5d9f3ac60 Only set the lagging flag for select_pool() on failed getwork if we're not in opt_fail_only mode. 2012-12-10 10:32:21 +11:00
Con Kolivas
383b42f23e Set the pool lagging flag on startup to avoid it being shown initially, and only unset it once the maximum number of staged work items has been reached. 2012-12-09 17:15:13 +11:00
Con Kolivas
8feb302945 Avoid recursive locking of the stgd lock. 2012-12-09 15:38:44 +11:00
Con Kolivas
c59aeb56ff Revert "Wake the getwork scheduler after every restart threads."
This reverts commit 5b03e7497d.

Redundant.
2012-12-09 15:29:06 +11:00
Con Kolivas
31f75098b5 Selectively discard all work items if a longpoll or stratum restart is received without a new block to work on. 2012-12-09 15:28:30 +11:00
Con Kolivas
5b03e7497d Wake the getwork scheduler after every restart threads. 2012-12-09 15:11:49 +11:00
Con Kolivas
01b9c6dfbf Make main() the getwork scheduler once everything is set up, so that all app exits use the kill_work and quit paths. 2012-12-09 08:22:13 +11:00
Con Kolivas
30f6840b5c Only consider work stale for stratum of different job_id if it's not a share. 2012-12-08 22:08:23 +11:00
Con Kolivas
67a9af68a1 Hash_pop should signal further waiters on its own pthread conditional in case there are multiple waiters. 2012-12-08 21:53:06 +11:00
Con Kolivas
5c4c2d6786 Check the job_id has not changed on stratum work when deciding if the work is stale as might occur across disconnections. 2012-12-08 21:45:15 +11:00
Con Kolivas
fcb265322d Perform pool_resus on getwork pool that generates work in getwork_thread. 2012-12-08 21:35:14 +11:00
Con Kolivas
3d1e9f5098 Set pool lagging message for getwork pool that falls to zero staged in getwork thread. 2012-12-08 21:32:49 +11:00
Con Kolivas
927730ae2c Stage extra work when the primary pool is a getwork pool without rolltime. 2012-12-08 21:27:40 +11:00
Con Kolivas
24de9b8655 Do not try to clean up twice if kill message is given. 2012-12-08 21:23:33 +11:00
Con Kolivas
84b44fd852 Only recalculate total_staged in getwork thread if required. 2012-12-08 21:21:19 +11:00
Con Kolivas
b28055517e Implement a completely new getwork scheduler.
Stage all work from the one thread, making it possible to serialise all requests minimising the number of getworks requested or local work generated.
Use a pthread conditional to wake up the thread whenever work is removed to generate enough work to stay above the watermark set by opt_queue.
Remove all remnants of the old queueing mechanism, deleting the now defunct queued count.
2012-12-08 21:13:04 +11:00
Con Kolivas
dd65818295 Remove all references to the now unused workio_cmd structure. 2012-12-07 13:45:03 +11:00
Con Kolivas
ed1b5cae0d Remove the old workio command queue thread, replacing it with a kill conditional to exit the program. 2012-12-07 13:40:26 +11:00
Con Kolivas
59ddfd07a7 Remove getwork command from workio_cmd queues and do them directly from queue_request. 2012-12-07 13:32:23 +11:00
Con Kolivas
c99636f21b Begin tearing down the old workio command queues by removing submit commands from there and submit them asynchronously via their own threads. 2012-12-07 13:21:46 +11:00
Luke Dashjr
1a8fe32e4c Bugfix: Free filename entry for writing config file when done with it 2012-12-06 19:11:01 +00:00
Con Kolivas
c0cd006f42 Allow pool active to be called on stratum or disabled pools in the watchpool thread if the pool has not been probed. 2012-12-04 21:49:11 +11:00
Con Kolivas
52b4bae961 Combine shared padding into one char. 2012-12-04 21:29:49 +11:00
Con Kolivas
e14d1d6e2a Merge pull request #340 from kanoi/main
lock the threaded statistics updates
2012-12-04 00:18:10 -08:00
Kano
120fc7aff9 lock (most of) the threaded statistics updates 2012-12-04 19:14:27 +11:00
ckolivas
b86aa20bf6 Make need connection return true if a pool is idle. 2012-12-04 11:06:35 +11:00
Con Kolivas
777f0573c3 Merge pull request #339 from kanoi/api
API lock access to some summary statistics + API add Best Share to summary
2012-12-03 04:19:17 -08:00
Kano
e55fe73f9a API add Best Share to summary 2012-12-03 23:08:11 +11:00
Con Kolivas
c4b17ae918 Check on creating new GBT work if the structures are up to date and update them as required rather than regularly. 2012-12-03 17:54:57 +11:00
Con Kolivas
401357e657 Enable backup stratum connections for getwork when the primary pool doesn't have longpoll aka solo mining. 2012-12-03 16:45:43 +11:00
Con Kolivas
289d6807ef Check for correct absence of opt_fail_only in cnx_needed. 2012-12-03 16:16:00 +11:00
Con Kolivas
4b28c8595b Remove unused variable. 2012-12-03 15:28:52 +11:00
Con Kolivas
f4d305a9cd The specification for stratum has been elaborated to say that a changed diff applies only to new work so do not retarget when submitting shares. 2012-12-03 15:26:58 +11:00
Con Kolivas
1ad671b094 Use a variable length string array in submit_upstream_work to cope with massive GBT submissions. 2012-12-03 15:17:44 +11:00
Kano
a67e96c3e4 API lock access to some summary statistics (and copy them) 2012-12-03 11:36:15 +11:00
Con Kolivas
fc5d3a0eaf Suspend stratum connections to backup pools when there is no requirement to potentially grab work from them. 2012-12-03 09:52:46 +11:00
Con Kolivas
9a71654761 Merge pull request #338 from denis2342/threadname
small patch to add names to threads, should work for linux, freebsd and osx
2012-12-02 12:46:01 -08:00
Denis Ahrens
4fbdc1eaa8 enumerate the mining threadnames 2012-12-02 18:36:15 +01:00
Kano
152e7e36a2 mmq usb v0.4 + api usb stats 2012-12-02 21:48:37 +11:00
Denis Ahrens
271b05ab04 setting the name of the threads for linux,freebsd,openbsd and osx
code is borrowed from bitcoins util.c, so it is already tested
2012-12-02 11:39:20 +01:00
Con Kolivas
4584068c67 Don't show broken WU value with scrypt mining. 2012-12-02 20:51:21 +11:00
Con Kolivas
b8843546e3 Remove unused getwork times in getswork. 2012-12-02 20:45:57 +11:00
Con Kolivas
cc14f16670 Make gen_stratum_work more robust by using a dynamically allocated array for the header in case bogus data is sent by the pool to avoid overflowing a static array. 2012-12-02 19:29:54 +11:00
Con Kolivas
f94cff77e6 Microoptimise and remove redundant copy of strdup function in calloc_strcat. 2012-12-02 18:06:55 +11:00
Con Kolivas
53c9cdaf56 scrypt_diff now returns a uint64_t 2012-12-02 16:56:36 +11:00
Con Kolivas
d8e18994d5 Support monitoring and reporting much higher diffs for scrypt mining, truncating irrelevant zeroes from displayed hash. 2012-12-01 23:36:17 +11:00
Con Kolivas
0ae02c6ec4 Since we will be using calloc_str to put a string into it, convert the function to calloc_strcat which does it automatically. 2012-12-01 08:26:31 +11:00
Con Kolivas
01eb807ca0 Revert "Handle crash exceptions by trying to restart cgminer unless the --no-restart option is used."
This reverts commit 68c881fde7.

Does not reliably restart on crashes often enough and makes debugging more difficult.
2012-11-29 13:00:02 +11:00
Con Kolivas
bc4f6d928a Count longpoll and GBT decodes as queued work since the count otherwise remains static. 2012-11-29 12:58:42 +11:00
Con Kolivas
1746e4714e Use the string helper functions to create gbt blocks of any length. 2012-11-29 12:49:28 +11:00
Con Kolivas
217be6ed98 Do away with the flaky free_work api in the driver code which would often lose the work data in opencl and simply flush it before exiting the opencl scanhash. 2012-11-25 00:37:46 +11:00
Con Kolivas
c34ff36763 Use base_work for comparison just for cleanness in __copy_work 2012-11-24 23:08:14 +11:00
Con Kolivas
73671ab360 Remove all static work structs, using the make and free functions. 2012-11-24 18:45:02 +11:00
Con Kolivas
3ab92ef6ad Add pool no. to stale share detected message. 2012-11-24 13:35:00 +11:00
Con Kolivas
850d07dffb Add info about which pool share became stale while resubmitting. 2012-11-24 12:58:58 +11:00
Con Kolivas
31e43944bc Do not use or count or use the getworks submitted which are simply testing that pools are still up. This was increasing share leakage and making stats not reflect real work. 2012-11-24 10:58:46 +11:00
Con Kolivas
2d35ac2567 Track all dynamically allocated memory within the work struct by copying work structs in a common place, creating freshly allocated heap ram for all arrays within the copied struct.
Clear all work structs from the same place to ensure memory does not leak from arrays within the struct.
Convert the gbt coinbase and stratum strings within the work struct to heap ram.
This will allow arbitrary lengths without an upper limit for the strings, preventing the overflows that happen with GBT.
2012-11-24 10:47:20 +11:00
Con Kolivas
aa72db369e Provide rudimentary support for the balancing failover strategies with stratum and GBT by switching pools silently on getwork requests. 2012-11-18 23:04:01 +11:00
Con Kolivas
40a3331e72 Remove unintentional block of code in reuse_work. 2012-11-18 22:27:03 +11:00
Con Kolivas
9ad02fe303 Support workid for block submission on GBT pools that use it. 2012-11-18 21:48:44 +11:00
Con Kolivas
61f4e9d604 Revert "Discard all work on longpoll, not just work cgminer recognises as stale."
This reverts commit 1470eea903.

Work block update makes this unnecessary.
2012-11-18 17:22:48 +11:00
Con Kolivas
f14bf5b16c Merge pull request #326 from pshep/error_counters
Error counters
2012-11-17 22:06:49 -08:00
Con Kolivas
4039ee7a93 Convert pool not responding and pool alive message on backup pools to verbose level only since they mean a single failed getwork. 2012-11-18 16:53:39 +11:00
Con Kolivas
52b86b5137 Update work block on the longpoll work item before calling restart threads to ensure all work but the longpoll work item gets discarded when we call discard_stale from restart_threads. 2012-11-18 16:38:24 +11:00
Con Kolivas
1470eea903 Discard all work on longpoll, not just work cgminer recognises as stale. 2012-11-18 15:54:14 +11:00
Con Kolivas
88983306fd Do not attempt to remove the stratum share hash after unsuccessful submission since it may already be removed by clear_stratum_shares. 2012-11-18 15:50:04 +11:00
Con Kolivas
d15515bea4 Check against a double for current pool diff. 2012-11-15 13:09:00 +11:00
Con Kolivas
b3864d1a94 Support for fractional diffs and the classic just-below-1 share all FFs diff target. 2012-11-15 09:18:58 +11:00
Con Kolivas
1832dbd7f6 Make header larger on gen stratum work to accomodate \0 at the end. 2012-11-11 22:57:48 +11:00
Con Kolivas
66a9577197 Fix mistaken disabling of opt_restart in other code. 2012-11-11 21:48:07 +11:00
Con Kolivas
89cb14199a Use stratum block change from backup pools as an alternative to longpoll for pools that don't support LP. 2012-11-11 20:53:27 +11:00
Con Kolivas
38eb4ee43b Check share target diff for best_share to be calculated when solo mining. 2012-11-11 18:09:46 +11:00
Con Kolivas
7993095ec3 Round some more static string arrays to 4 byte boundaries. 2012-11-11 17:53:20 +11:00
Con Kolivas
17aa87be3a There is no need for the static arrays to be larger than required, so long as they're 4 byte aligned to appease ARM. 2012-11-11 17:37:58 +11:00
Con Kolivas
149781cf47 Revert "Change default log interval to 3 seconds for faster screen refreshes since vardiff will prevent massive on screen hash updates in the future."
This reverts commit f1f6b31faf.

Screen update frequency is what I wanted to change, not the log interval.
2012-11-11 17:14:55 +11:00
Con Kolivas
298ffcbc9e Store the full stratum url information in rpc_url for correct configuration file saving. 2012-11-11 17:14:24 +11:00
Con Kolivas
2cf0767cff Put in a hack to prevent dud work from sneaking into test_work_current being seen as a new block. 2012-11-11 16:33:20 +11:00
Con Kolivas
ad2ed57f12 Reset the work->longpoll flag where it will affect stratum work items as well. 2012-11-11 16:30:09 +11:00
Con Kolivas
1d7e19f2f2 Check for both coinbase/append and submit/coinbase support before using GBT protocol. 2012-11-11 16:10:45 +11:00
Con Kolivas
878f4d53ab First pass through testing for GBT should not set probed to true since we are about to probe again. 2012-11-11 16:05:39 +11:00
Con Kolivas
598ee76d37 Hash1 is only used by the deprecated cpu mining code and never changes so remove it from the work struct and bypass needing to process the value for all other mining. 2012-11-11 09:51:37 +11:00
Con Kolivas
f1f6b31faf Change default log interval to 3 seconds for faster screen refreshes since vardiff will prevent massive on screen hash updates in the future. 2012-11-07 23:32:01 +11:00
Con Kolivas
6893c0be43 Get a work item once per second for all getwork and GBT pools to test they're still alive and to maintain a current GBT template. 2012-11-07 23:28:49 +11:00
Paul Sheppard
dad6c70420 Merge branch 'master' into error_counters 2012-11-06 09:46:05 -08:00
Con Kolivas
dd671baaa1 Get a fresh block template with GBT pools on switching to them. 2012-11-06 17:42:49 +11:00
Con Kolivas
be82cc7fba Reset work flags to prevent GBT shares from being submitted as stratum ones after switching. 2012-11-06 14:01:32 +11:00
Con Kolivas
a47a7886d5 Only retarget stratum shares to new pool diff if diff has dropped. 2012-11-06 11:39:25 +11:00
Con Kolivas
498882d829 Remove resetting of probed variable when detecting GBT. 2012-11-06 10:39:34 +11:00
Con Kolivas
27ce497a7c Count lost stratum share submits and increase message priority to warning. 2012-11-06 09:50:36 +11:00
Con Kolivas
418d15deba Only retrieve a new block template for GBT pools that are the current pool. 2012-11-06 09:43:55 +11:00
Paul Sheppard
69f341c5bb Remove errant counter. 2012-11-05 08:01:15 -08:00
Con Kolivas
75d0a45a10 Show which pool untracked share messages have come from. 2012-11-05 23:47:44 +11:00
Con Kolivas
e0157208ab Add management for dead GBT pools. 2012-11-05 23:44:00 +11:00
Con Kolivas
9ebc321cd1 Merge branch 'master' into gbt 2012-11-05 23:34:58 +11:00
Con Kolivas
ffb8a29abf Count lost shares with stratum as submit stale lost. 2012-11-05 23:25:36 +11:00
Con Kolivas
0465fef553 Discard record of stratum shares sent and report lost shares on disconnection since they will never be reported back. 2012-11-05 23:22:36 +11:00
Con Kolivas
0314081157 Swab, don't just swap the bytes in the GBT target. 2012-11-05 22:12:27 +11:00
Con Kolivas
275bb9c05e Change status window message for GBT connected pools versus LP. 2012-11-05 18:05:25 +11:00
Con Kolivas
1321cb0e0d Generate a gbt work item from longpoll when required to set new block and message appropriately. 2012-11-05 17:57:33 +11:00
Con Kolivas
10ea5fbf97 Use existing pool submit_old bool from gbt data. 2012-11-05 16:57:48 +11:00
Con Kolivas
f71b423080 Retrieve a new block template if more than 30 seconds has elapsed since the last one to keep the data current and test the pool is still alive. 2012-11-05 16:48:19 +11:00
Con Kolivas
fc94e00fd1 Update GBT longpollid every time we request a new longpoll. 2012-11-05 16:34:44 +11:00
Con Kolivas
cc7c274543 Manage appropriate response codes for share submission with GBT. 2012-11-05 16:28:52 +11:00
Con Kolivas
345e72e66e Allow the longpoll thread to start with GBT and only set the longpollid once. 2012-11-05 16:17:04 +11:00
Con Kolivas
85f400bf80 Correct last few components of GBT block generation courtesy of Luke-jr. 2012-11-05 15:57:47 +11:00
Con Kolivas
14c436ee1f Use correct length for offsetting extra nonce and remaining data. 2012-11-05 15:28:07 +11:00
Paul Sheppard
9f74e650b3 Tidy up device error counts 2012-11-04 20:17:43 -08:00
Con Kolivas
a4e78be1ed Flip all 80 bytes in the flip function which was wrongly named flip256 for its purpose. 2012-11-05 14:56:57 +11:00
Con Kolivas
8bc677a6ca Calculate midstate for gbt work and remove now unused variable. 2012-11-05 14:44:58 +11:00
Con Kolivas
0ba5f0f94b Use a standard function for flipping bytes. 2012-11-05 14:02:43 +11:00
Con Kolivas
734f3d1c54 Insert the extra nonce and remaining data in the correct position in the coinbase. 2012-11-05 11:49:22 +11:00
Con Kolivas
611c3164dc Remove txn size debugging and enlarge gbt block string to prevent overflow. 2012-11-05 10:55:55 +11:00
Con Kolivas
bd384883da Remove varint display debugging. 2012-11-05 08:39:33 +11:00
Con Kolivas
cb6f0340cd Build varint correctly for share submission and sleep 5 seconds before retrying submit. 2012-11-05 08:27:20 +11:00
Con Kolivas
88b6f7924c Make gbt_coinbase large enough for submissions, swap bytes correctly to make a header from GBT and encode the number of transactions in share submission. 2012-11-04 18:01:09 +11:00
Con Kolivas
889ed23934 Store the fixed size entries as static variables in GBT in binary form, byteswapping as is required. 2012-11-04 15:28:13 +11:00