Skip to content

Commit

Permalink
compensate expected payout amount for donation percentage
Browse files Browse the repository at this point in the history
  • Loading branch information
forrestv committed Oct 17, 2012
1 parent 71c0303 commit 53cac86
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion p2pool/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ def upnp_thread():
get_current_txouts = lambda: p2pool_data.get_expected_payouts(tracker, best_share_var.value, bitcoind_work.value['bits'].target, bitcoind_work.value['subsidy'], net)

wb = work.WorkerBridge(my_pubkey_hash, net, args.donation_percentage, bitcoind_work, best_block_header, merged_urls, best_share_var, tracker, my_share_hashes, my_doa_share_hashes, args.worker_fee, p2p_node, submit_block, set_best_share, broadcast_share, block_height_var)
web_root = web.get_web_root(tracker, bitcoind_work, get_current_txouts, datadir_path, net, wb.get_stale_counts, my_pubkey_hash, wb.local_rate_monitor, args.worker_fee, p2p_node, wb.my_share_hashes, wb.pseudoshare_received, wb.share_received, best_share_var, bitcoind_warning_var, traffic_happened)
web_root = web.get_web_root(tracker, bitcoind_work, get_current_txouts, datadir_path, net, wb.get_stale_counts, my_pubkey_hash, wb.local_rate_monitor, args.worker_fee, p2p_node, wb.my_share_hashes, wb.pseudoshare_received, wb.share_received, best_share_var, bitcoind_warning_var, traffic_happened, args.donation_percentage)
worker_interface.WorkerInterface(wb).attach_to(web_root, get_handler=lambda request: request.redirect('/static/'))

deferral.retry('Error binding to worker port:', traceback=False)(reactor.listenTCP)(worker_endpoint[1], server.Site(web_root), interface=worker_endpoint[0])
Expand Down
3 changes: 2 additions & 1 deletion p2pool/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def _atomic_write(filename, data):
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, bitcoin_warning_var, traffic_happened):
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, traffic_happened, donation_percentage):
start_time = time.time()

web_root = resource.Resource()
Expand Down Expand Up @@ -176,6 +176,7 @@ def get_local_stats():
attempts_to_block=bitcoin_data.target_to_average_attempts(bitcoind_work.value['bits'].target),
block_value=bitcoind_work.value['subsidy']*1e-8,
warnings=p2pool_data.get_warnings(tracker, best_share_var.value, net, bitcoin_warning_var.value, bitcoind_work.value),
donation_proportion=donation_percentage/100,
)

class WebInterface(deferred_resource.DeferredResource):
Expand Down
4 changes: 2 additions & 2 deletions web-static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
var time_to_block = local_stats.attempts_to_block/global_stats.pool_hash_rate;
d3.select('#time_to_block').text(d3.format('.3r')(time_to_block/3600) + " hours");

d3.select('#expected_payout_amount').text(d3.format('.3r')(local/global_stats.pool_hash_rate*local_stats.block_value));
d3.select('#expected_payout_amount').text(d3.format('.3r')(local/global_stats.pool_hash_rate*local_stats.block_value*(1-local_stats.donation_proportion)));
});
});

Expand Down Expand Up @@ -104,7 +104,7 @@ <h1>P2Pool</h1>
<p>Node uptime: <span id="uptime_days"></span> days Peers: <span id="peers_out"></span> out, <span id="peers_in"></span> in</p>
<p>Local rate: <span id="local_rate"></span> (<span id="local_doa"></span> DOA) Expected time to share: <span id="time_to_share"></span></p>
<p>Shares: <span id="shares_total"></span> total (<span id="shares_orphan"></span> orphaned, <span id="shares_dead"></span> dead) Efficiency: <span id="efficiency"></span></p>
<p>Payout if a block were found NOW: <span id="payout_amount"></span> <span class="symbol"></span> to <span id="payout_addr"></span>. Expected: <span id="expected_payout_amount"></span> <span class="symbol"></span></p>
<p>Payout if a block were found NOW: <span id="payout_amount"></span> <span class="symbol"></span> to <span id="payout_addr"></span>. Expected after mining for 24 hours: <span id="expected_payout_amount"></span> <span class="symbol"></span></p>
<p>Current block value: <span id="block_value"></span> <span class="symbol"></span> Expected time to block: <span id="time_to_block"></span></p>
<div id="warnings"></div>

Expand Down

0 comments on commit 53cac86

Please sign in to comment.