Esempio n. 1
0
def difficulty_cutoff(source):
    """
    returns the difficulty cut off for the pool
    """

    diff = btcnet_info.get_difficulty(source.coin)
    btc_diff = btcnet_info.get_difficulty(source.coin)
    if not diff:
        return 0
        #while not diff:
        #    gevent.sleep(0)
        #    diff = btcnet_info.get_difficulty(source.coin)

    diff = float(diff)
    btc_diff = float(btc_diff)

    #Propositional Hopping
    if source.payout_scheme in ['prop']:
        return diff * 0.435

    #Score Hopping
    if source.payout_scheme in ['score']:
        c = source.mine.c if source.mine and source.mine.c else 300
        c = float(c)
        hashrate = float(source.rate) / (10. ** 9) if source.rate else 1
        hopoff = btc_diff * (0.0164293 + 1.14254 / (1.8747 * (btc_diff / (c * hashrate)) + 2.71828))
        return hopoff
Esempio n. 2
0
def difficulty_cutoff(source):
    """
    returns the difficulty cut off for the pool
    """

    diff = btcnet_info.get_difficulty(source.coin)
    btc_diff = btcnet_info.get_difficulty(source.coin)
    if not diff:
        return 0
        #while not diff:
        #    gevent.sleep(0)
        #    diff = btcnet_info.get_difficulty(source.coin)

    diff = float(diff)
    btc_diff = float(btc_diff)

    #Propositional Hopping
    if source.payout_scheme in ['prop']:
        return diff * 0.435

    #Score Hopping
    if source.payout_scheme in ['score']:
        c = source.mine.c if source.mine and source.mine.c else 300
        c = float(c)
        hashrate = float(source.rate) / (10.**9) if source.rate else 1
        hopoff = btc_diff * (0.0164293 + 1.14254 /
                             (1.8747 * (btc_diff / (c * hashrate)) + 2.71828))
        return hopoff
Esempio n. 3
0
def get_diff(pool):
    coin = btcnet_info.get_pool(pool)
    if coin:
        coin = coin.coin
    else:
        coin = 'btc'
    return float(btcnet_info.get_difficulty(coin))
Esempio n. 4
0
def get_diff(pool):
    coin = btcnet_info.get_pool(pool)
    if coin:
        coin = coin.coin
    else:
        coin = 'btc'
    return float(btcnet_info.get_difficulty(coin))
Esempio n. 5
0
 def testdiff_cutoff(self):
     example = FakePool()
     self.assertEqual(
         self.logic.difficulty_cutoff(example),
         float(btcnet_info.get_difficulty(example.coin)) * 0.435)
Esempio n. 6
0
 def testdiff_cutoff(self):
     example = FakePool()
     self.assertEqual(self.logic.difficulty_cutoff(example), 
         float(btcnet_info.get_difficulty(example.coin)) * 0.435)