os.remove(filename)
os.rename(filename + '.new', filename)
-def get_web_root(tracker, bitcoind_work, get_current_txouts, datadir_path, net, get_stale_counts, my_pubkey_hash, local_rate_monitor, worker_fee, p2p_node, my_share_hashes, pseudoshare_received, share_received, best_share_var):
+def get_web_root(tracker, bitcoind_work, get_current_txouts, datadir_path, net, get_stale_counts, my_pubkey_hash, local_rate_monitor, worker_fee, p2p_node, my_share_hashes, pseudoshare_received, share_received, best_share_var, bitcoin_warning_var):
start_time = time.time()
web_root = resource.Resource()
),
uptime=time.time() - start_time,
block_value=bitcoind_work.value['subsidy']*1e-8,
- warnings=p2pool_data.get_warnings(tracker, best_share_var.value, net),
+ warnings=p2pool_data.get_warnings(tracker, best_share_var.value, net, bitcoin_warning_var.value),
)
class WebInterface(deferred_resource.DeferredResource):
web_root.putChild('rate', WebInterface(lambda: p2pool_data.get_pool_attempts_per_second(tracker, best_share_var.value, 720)/(1-p2pool_data.get_average_stale_prop(tracker, best_share_var.value, 720))))
web_root.putChild('difficulty', WebInterface(lambda: bitcoin_data.target_to_difficulty(tracker.items[best_share_var.value].max_target)))
web_root.putChild('users', WebInterface(get_users))
+ web_root.putChild('user_stales', WebInterface(lambda: dict((bitcoin_data.pubkey_hash_to_address(ph, net.PARENT), prop) for ph, prop in
+ p2pool_data.get_user_stale_props(tracker, best_share_var.value, tracker.get_height(best_share_var.value)).iteritems())))
web_root.putChild('fee', WebInterface(lambda: worker_fee))
web_root.putChild('current_payouts', WebInterface(lambda: dict((bitcoin_data.script2_to_address(script, net.PARENT), value/1e8) for script, value in get_current_txouts().iteritems())))
web_root.putChild('patron_sendmany', WebInterface(get_patron_sendmany, 'text/plain'))
new_root.putChild('tails', WebInterface(lambda: ['%064x' % x for t in tracker.tails for x in tracker.reverse.get(t, set())]))
new_root.putChild('verified_tails', WebInterface(lambda: ['%064x' % x for t in tracker.verified.tails for x in tracker.verified.reverse.get(t, set())]))
new_root.putChild('best_share_hash', WebInterface(lambda: '%064x' % best_share_var.value))
+ def get_share_data(share_hash_str):
+ if int(share_hash_str, 16) not in tracker.items:
+ return ''
+ share = tracker.items[int(share_hash_str, 16)]
+ return p2pool_data.share_type.pack(share.as_share1a())
+ new_root.putChild('share_data', WebInterface(lambda share_hash_str: get_share_data(share_hash_str), 'application/octet-stream'))
new_root.putChild('currency_info', WebInterface(lambda: dict(
symbol=net.PARENT.SYMBOL,
block_explorer_url_prefix=net.PARENT.BLOCK_EXPLORER_URL_PREFIX,