@@ -745,26 +745,32 @@ class MinerCLI
745
745
746
746
void calcFinalTarget (GenericFarm<EthashProofOfWork>& f, h256& _target, uint64_t & _difficulty)
747
747
{
748
+ // on input we're expecting that target and difficulty are set to the values specified by the pool.
748
749
static float s_lastRate = 0 ;
749
750
750
- float currentRate;
751
-
752
751
// if we're going by the pool difficulty, do nothing
753
752
if (m_minutesPerShare == -1 ) return ;
754
753
755
- currentRate = f.hashRates ().farmRate ();
754
+ float currentRate = f.hashRates ().farmRate ();
755
+ LogF << " Trace: calcFinalTarget - s_lastRate : " << s_lastRate << " , farmRate : " << currentRate;
756
+ // the first time around we usually don't have good hash rate information yet.
756
757
if (s_lastRate == 0 || currentRate == 0 )
757
- currentRate = f.minerCount () * 500 ; // assume 500 MH/s per gpu
758
+ currentRate = f.minerCount () * 400 ; // take a guess at hash rates
758
759
759
760
// only recalculate if change is > 10%
760
- if (abs (s_lastRate - currentRate) / s_lastRate > 0.1 )
761
+ if (s_lastRate == 0 || abs (s_lastRate - currentRate) / s_lastRate > 0.1 )
762
+ {
761
763
s_lastRate = currentRate;
764
+ LogF << " Trace: calcFinalTarget - New s_lastRate : " << s_lastRate;
765
+ }
762
766
763
767
double divisor = s_lastRate * 1000000.0 * m_minutesPerShare * 60 ;
764
768
uint64_t target64 = (divisor == 0 ) ? 0 : ~uint64_t (0 ) / divisor;
765
769
u256 target256 = target64;
766
770
_target = target256 << 192 ;
767
771
_difficulty = diffFromTarget (_target);
772
+ LogF << " Trace: calcFinalTarget - Target : " << std::hex << std::setw (16 ) << std::setfill (' 0' ) << upper64OfHash (_target)
773
+ << " , difficulty : " << std::dec << _difficulty;
768
774
}
769
775
770
776
0 commit comments