tutulino / Megaminer

Multipool and multialgo windows miner
GNU General Public License v3.0
78 stars 69 forks source link

Miner gets stuck on a coin if the profit is high even if the miner count drops below config value #402

Open thebeerbaron2018 opened 6 years ago

thebeerbaron2018 commented 6 years ago

Forgive me - I am on a mobile device and it's difficult to pull requests / forks.

Please see code change to core.ps1 below for your approval. This extra IF statement checks the poolworkers of the currently active miner are above the required amount specified in the config - if not then it sets the miner to pending cancelled so the code may choose a new miner that has the required number of workers on the pool.

(by the way you have a spelling mistake on line 816 "Iddle" should be "Idle"

Hope this helps

Regards TheBeerBaron

        #look for last round best
            $Candidates = $ActiveMiners | Where-Object {$_.GpuGroup.Id -eq $Type.Id}
            $BestLast = $Candidates.subminers | Where-Object {$_.Status -eq "Running" -or $_.Status -eq 'PendingCancellation'}
            if ($BestLast -ne $null) {
                $ProfitLast=$BestLast.profits
                $BestLastLogMsg=$ActiveMiners[$BestLast.IdF].name+"/"+$ActiveMiners[$BestLast.IdF].Algorithms+'/'+$ActiveMiners[$BestLast.IdF].Coin+" with Power Limit "+[string]$BestLast.PowerLimit+" (id "+[string]$BestLast.IdF+"-"+[string]$BestLast.Id+") for group "+$Type.groupname
                } 
            else {
                    $ProfitLast=0
}
        #look for last round best
            $Candidates = $ActiveMiners | Where-Object {$_.GpuGroup.Id -eq $Type.Id}
            $BestLast = $Candidates.subminers | Where-Object {$_.Status -eq "Running" -or $_.Status -eq 'PendingCancellation'}
            if ($BestLast -ne $null) {
                $ProfitLast=$BestLast.profits
                $BestLastLogMsg=$ActiveMiners[$BestLast.IdF].name+"/"+$ActiveMiners[$BestLast.IdF].Algorithms+'/'+$ActiveMiners[$BestLast.IdF].Coin+" with Power Limit "+[string]$BestLast.PowerLimit+" (id "+[string]$BestLast.IdF+"-"+[string]$BestLast.Id+") for group "+$Type.groupname

                if (($ActiveMiners[$BestLast.IdF].PoolWorkers) -le ($config.MINWORKERS)) {
                    $BestLast.Status='PendingCancellation'
                    Writelog ("Cancelling miner due to low worker count") $LogFile $true
                    }

                } 
            else {
                    $ProfitLast=0
                }
thebeerbaron2018 commented 6 years ago

Additional information to demonstrate the problem: Set @@MINWORKERS=100 in the config file Allow the program to start. It will initially select a pool with >100 workers. If that algorithm then reports most profitable but workers drops to 5 the code will remain on this miner/pool/algo combo even though the profit is still recorded as high but there are not enough workers to efficiently find a block. The only time it will switch out of that scenario using the original code is if one of the other algorithms becomes more profitable. I had a situation today where Xevan was showing a profit value 5x anything other combination. Therefore it was stuck for over 5 hours being the only miner on the pool!

Rimplestilhskin commented 6 years ago

Great stuff, will test it, I have seen the same for workers and it is very sensitive with wrong numbers reported as zero workers / miners active yet 200 -2000 is mining on the same pool.

also some algo's or coins need to have a modified decimal spacing in one of the files to correct the wrong Euro / USD 165 for 22mh vs actual $1.65 profit per day. Maybe this decimal edit can help you until a fix is implemented.