Created
January 8, 2014 23:50
-
-
Save kke/8326956 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static inline bool should_roll(struct work *work) | |
| { | |
| struct timeval now; | |
| time_t expiry; | |
| if (work->pool != current_pool() && pool_strategy != POOL_LOADBALANCE && pool_strategy != POOL_BALANCE) | |
| return false; | |
| if (work->rolltime > opt_scantime) | |
| expiry = work->rolltime; | |
| else | |
| expiry = opt_scantime; | |
| expiry = expiry * 2 / 3; | |
| /* We shouldn't roll if we're unlikely to get one shares' duration | |
| * work out of doing so */ | |
| cgtime(&now); | |
| if (now.tv_sec - work->tv_staged.tv_sec > expiry) | |
| return false; | |
| return true; | |
| } | |
| /* Limit rolls to 7000 to not beyond 2 hours in the future where bitcoind will | |
| * reject blocks as invalid. */ | |
| static inline bool can_roll(struct work *work) | |
| { | |
| return (!work->stratum && work->pool && work->rolltime && !work->clone && | |
| work->rolls < 7000 && !stale_work(work, false)); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment