added block number and link to share to "Blocks found in last day" table
authorForrest Voight <forrest@forre.st>
Wed, 17 Oct 2012 23:39:37 +0000 (19:39 -0400)
committerForrest Voight <forrest@forre.st>
Wed, 17 Oct 2012 23:39:37 +0000 (19:39 -0400)
p2pool/web.py
web-static/index.html

index ec7b461..72badbf 100644 (file)
@@ -13,7 +13,7 @@ from twisted.web import resource, static
 import p2pool
 from bitcoin import data as bitcoin_data
 from . import data as p2pool_data
-from util import deferred_resource, graph, math
+from util import deferred_resource, graph, math, pack
 
 def _atomic_read(filename):
     try:
@@ -216,7 +216,12 @@ def get_web_root(tracker, bitcoind_work, get_current_txouts, datadir_path, net,
     ))))
     web_root.putChild('peer_versions', WebInterface(lambda: dict(('%s:%i' % peer.addr, peer.other_sub_version) for peer in p2p_node.peers.itervalues())))
     web_root.putChild('payout_addr', WebInterface(lambda: bitcoin_data.pubkey_hash_to_address(my_pubkey_hash, net.PARENT)))
-    web_root.putChild('recent_blocks', WebInterface(lambda: [dict(ts=s.timestamp, hash='%064x' % s.header_hash) for s in tracker.get_chain(best_share_var.value, min(tracker.get_height(best_share_var.value), 24*60*60//net.SHARE_PERIOD)) if s.pow_hash <= s.header['bits'].target]))
+    web_root.putChild('recent_blocks', WebInterface(lambda: [dict(
+        ts=s.timestamp,
+        hash='%064x' % s.header_hash,
+        number=pack.IntType(24).unpack(s.share_data['coinbase'][1:4]),
+        share='%064x' % s.hash,
+    ) for s in tracker.get_chain(best_share_var.value, min(tracker.get_height(best_share_var.value), 24*60*60//net.SHARE_PERIOD)) if s.pow_hash <= s.header['bits'].target]))
     web_root.putChild('uptime', WebInterface(lambda: time.time() - start_time))
     web_root.putChild('stale_rates', WebInterface(lambda: p2pool_data.get_stale_counts(tracker, best_share_var.value, 720, rates=True)))
     
index bf5c02f..8e7f173 100644 (file)
@@ -2,6 +2,7 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
     <head>
+        <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
         <title>P2Pool</title>
         <link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
         <script type="text/javascript" src="d3.v2.min.js"></script>
                 
                 d3.json('/recent_blocks', function(blocks) {
                     var tr = d3.select('#blocks').selectAll().data(blocks).enter().append('tr');
-                    tr.append('td').text(function(block){return new Date(1000*block.ts).toString()})
+                    tr.append('td').text(function(block){return new Date(1000*block.ts).toString()});
+                    tr.append('td').text(function(block){return block.number});
                     tr.append('td').append('a').text(function(block){return block.hash}).attr('href', function(block){return currency_info.block_explorer_url_prefix + block.hash});
+                    tr.append('td').append('a').text('→').attr('href', function(block){return 'share.html#' + block.share});
                 });
             });
             
         <h2>Blocks found in last day:</h2>
         <p>Note that blocks may have been orphaned from the P2Pool chain and so not be here.</p>
         <table border="1" id="blocks">
-            <tr><th>time</th><th>hash</th></tr>
+            <tr><th>time</th><th>number</th><th>hash/explorer link</th><th>share</th></tr>
         </table>
         
         <h2>Payouts if a block were found NOW:</h2>