try:
if time.time() > current_work2.value['last_update'] + 60:
print >>sys.stderr, '''---> LOST CONTACT WITH BITCOIND for 60 seconds, check that it isn't frozen or dead <---'''
- if current_work.value['best_share_hash'] is not None:
- height, last = tracker.get_height_and_last(current_work.value['best_share_hash'])
- if height > 2:
- (stale_orphan_shares, stale_doa_shares), shares, _ = get_stale_counts()
- stale_prop = p2pool_data.get_average_stale_prop(tracker, current_work.value['best_share_hash'], min(720, height))
- real_att_s = p2pool_data.get_pool_attempts_per_second(tracker, current_work.value['best_share_hash'], min(height - 1, 720)) / (1 - stale_prop)
-
- if first_pseudoshare_time is None and recent_shares_ts_work2:
- first_pseudoshare_time = recent_shares_ts_work2[0][0]
- while recent_shares_ts_work2 and recent_shares_ts_work2[0][0] < time.time() - average_period:
- recent_shares_ts_work2.pop(0)
- my_att_s = sum(work for ts, work, dead in recent_shares_ts_work2)/min(time.time() - first_pseudoshare_time, average_period) if first_pseudoshare_time is not None else 0
-
- this_str = 'Pool: %sH/s Stale rate: %.1f%% Average time between blocks: %.2f days' % (
- math.format(int(real_att_s)),
- 100*stale_prop,
- 2**256 / current_work.value['bits'].target / real_att_s / (60 * 60 * 24),
- )
- this_str += '\n Shares: %i (%i orphan, %i dead) Stale rate: %s Efficiency: %s Current payout: %.4f %s' % (
- shares, stale_orphan_shares, stale_doa_shares,
- math.format_binomial_conf(stale_orphan_shares + stale_doa_shares, shares, 0.95),
- math.format_binomial_conf(stale_orphan_shares + stale_doa_shares, shares, 0.95, lambda x: (1 - x)/(1 - stale_prop)),
- get_current_txouts().get(my_script, 0)*1e-8, net.PARENT.SYMBOL,
- )
- this_str += '\n Local: %sH/s (%.f min avg) Local dead on arrival: %s Expected time to share: %s' % (
- math.format(int(my_att_s)),
- (min(time.time() - first_pseudoshare_time, average_period) if first_pseudoshare_time is not None else 0)/60,
- math.format_binomial_conf(sum(1 for tx, work, dead in recent_shares_ts_work2 if dead), len(recent_shares_ts_work2), 0.95),
- '%.1f min' % (2**256 / tracker.shares[current_work.value['best_share_hash']].target / my_att_s / 60,) if my_att_s else '???',
- )
- this_str += '\n P2Pool: %i shares in chain (%i verified/%i total) Peers: %i (%i incoming)' % (
- height,
- len(tracker.verified.shares),
- len(tracker.shares),
- len(p2p_node.peers),
- sum(1 for peer in p2p_node.peers.itervalues() if peer.incoming),
- ) + (' FDs: %i R/%i W' % (len(reactor.getReaders()), len(reactor.getWriters())) if p2pool.DEBUG else '')
-
- if this_str != last_str or time.time() > last_time + 15:
- print this_str
- last_str = this_str
- last_time = time.time()
+
+ height = tracker.get_height(current_work.value['best_share_hash'])
+ this_str = 'P2Pool: %i shares in chain (%i verified/%i total) Peers: %i (%i incoming)' % (
+ height,
+ len(tracker.verified.shares),
+ len(tracker.shares),
+ len(p2p_node.peers),
+ sum(1 for peer in p2p_node.peers.itervalues() if peer.incoming),
+ ) + (' FDs: %i R/%i W' % (len(reactor.getReaders()), len(reactor.getWriters())) if p2pool.DEBUG else '')
+
+ if first_pseudoshare_time is None and recent_shares_ts_work2:
+ first_pseudoshare_time = recent_shares_ts_work2[0][0]
+ while recent_shares_ts_work2 and recent_shares_ts_work2[0][0] < time.time() - average_period:
+ recent_shares_ts_work2.pop(0)
+ my_att_s = sum(work for ts, work, dead in recent_shares_ts_work2)/min(time.time() - first_pseudoshare_time, average_period) if first_pseudoshare_time is not None else 0
+ this_str += '\n Local: %sH/s (%.f min avg) Local dead on arrival: %s Expected time to share: %s' % (
+ math.format(int(my_att_s)),
+ (min(time.time() - first_pseudoshare_time, average_period) if first_pseudoshare_time is not None else 0)/60,
+ math.format_binomial_conf(sum(1 for tx, work, dead in recent_shares_ts_work2 if dead), len(recent_shares_ts_work2), 0.95),
+ '%.1f min' % (2**256 / tracker.shares[current_work.value['best_share_hash']].target / my_att_s / 60,) if my_att_s else '???',
+ )
+
+ if height > 2:
+ (stale_orphan_shares, stale_doa_shares), shares, _ = get_stale_counts()
+ stale_prop = p2pool_data.get_average_stale_prop(tracker, current_work.value['best_share_hash'], min(720, height))
+ real_att_s = p2pool_data.get_pool_attempts_per_second(tracker, current_work.value['best_share_hash'], min(height - 1, 720)) / (1 - stale_prop)
+
+ this_str += '\n Shares: %i (%i orphan, %i dead) Stale rate: %s Efficiency: %s Current payout: %.4f %s' % (
+ shares, stale_orphan_shares, stale_doa_shares,
+ math.format_binomial_conf(stale_orphan_shares + stale_doa_shares, shares, 0.95),
+ math.format_binomial_conf(stale_orphan_shares + stale_doa_shares, shares, 0.95, lambda x: (1 - x)/(1 - stale_prop)),
+ get_current_txouts().get(my_script, 0)*1e-8, net.PARENT.SYMBOL,
+ )
+ this_str += '\n Pool: %sH/s Stale rate: %.1f%% Average time between blocks: %.2f days' % (
+ math.format(int(real_att_s)),
+ 100*stale_prop,
+ 2**256 / current_work.value['bits'].target / real_att_s / (60 * 60 * 24),
+ )
+
+ if this_str != last_str or time.time() > last_time + 15:
+ print this_str
+ last_str = this_str
+ last_time = time.time()
except:
log.err()
status_thread()