include txs in share explorer (and other share explorer improvements)
authorForrest Voight <forrest@forre.st>
Sun, 18 Aug 2013 20:54:49 +0000 (16:54 -0400)
committerForrest Voight <forrest@forre.st>
Tue, 20 Aug 2013 22:11:15 +0000 (18:11 -0400)
p2pool/bitcoin/networks.py
p2pool/web.py
web-static/index.html
web-static/share.html

index b3e7ace..a95f660 100644 (file)
@@ -23,6 +23,7 @@ nets = dict(
         CONF_FILE_FUNC=lambda: os.path.join(os.path.join(os.environ['APPDATA'], 'Bitcoin') if platform.system() == 'Windows' else os.path.expanduser('~/Library/Application Support/Bitcoin/') if platform.system() == 'Darwin' else os.path.expanduser('~/.bitcoin'), 'bitcoin.conf'),
         BLOCK_EXPLORER_URL_PREFIX='https://blockchain.info/block/',
         ADDRESS_EXPLORER_URL_PREFIX='https://blockchain.info/address/',
+        TX_EXPLORER_URL_PREFIX='https://blockchain.info/tx/',
         SANE_TARGET_RANGE=(2**256//2**32//1000 - 1, 2**256//2**32 - 1),
         DUMB_SCRYPT_DIFF=1,
         DUST_THRESHOLD=0.001e8,
@@ -43,6 +44,7 @@ nets = dict(
         CONF_FILE_FUNC=lambda: os.path.join(os.path.join(os.environ['APPDATA'], 'Bitcoin') if platform.system() == 'Windows' else os.path.expanduser('~/Library/Application Support/Bitcoin/') if platform.system() == 'Darwin' else os.path.expanduser('~/.bitcoin'), 'bitcoin.conf'),
         BLOCK_EXPLORER_URL_PREFIX='http://blockexplorer.com/testnet/block/',
         ADDRESS_EXPLORER_URL_PREFIX='http://blockexplorer.com/testnet/address/',
+        TX_EXPLORER_URL_PREFIX='http://blockexplorer.com/testnet/tx/',
         SANE_TARGET_RANGE=(2**256//2**32//1000 - 1, 2**256//2**32 - 1),
         DUMB_SCRYPT_DIFF=1,
         DUST_THRESHOLD=1e8,
@@ -64,6 +66,7 @@ nets = dict(
         CONF_FILE_FUNC=lambda: os.path.join(os.path.join(os.environ['APPDATA'], 'Namecoin') if platform.system() == 'Windows' else os.path.expanduser('~/Library/Application Support/Namecoin/') if platform.system() == 'Darwin' else os.path.expanduser('~/.namecoin'), 'bitcoin.conf'),
         BLOCK_EXPLORER_URL_PREFIX='http://explorer.dot-bit.org/b/',
         ADDRESS_EXPLORER_URL_PREFIX='http://explorer.dot-bit.org/a/',
+        TX_EXPLORER_URL_PREFIX='http://explorer.dot-bit.org/tx/',
         SANE_TARGET_RANGE=(2**256//2**32 - 1, 2**256//2**32 - 1),
         DUMB_SCRYPT_DIFF=1,
         DUST_THRESHOLD=0.2e8,
@@ -84,6 +87,7 @@ nets = dict(
         CONF_FILE_FUNC=lambda: os.path.join(os.path.join(os.environ['APPDATA'], 'Namecoin') if platform.system() == 'Windows' else os.path.expanduser('~/Library/Application Support/Namecoin/') if platform.system() == 'Darwin' else os.path.expanduser('~/.namecoin'), 'bitcoin.conf'),
         BLOCK_EXPLORER_URL_PREFIX='http://testnet.explorer.dot-bit.org/b/',
         ADDRESS_EXPLORER_URL_PREFIX='http://testnet.explorer.dot-bit.org/a/',
+        TX_EXPLORER_URL_PREFIX='http://testnet.explorer.dot-bit.org/tx/',
         SANE_TARGET_RANGE=(2**256//2**32 - 1, 2**256//2**32 - 1),
         DUMB_SCRYPT_DIFF=1,
         DUST_THRESHOLD=1e8,
@@ -105,6 +109,7 @@ nets = dict(
         CONF_FILE_FUNC=lambda: os.path.join(os.path.join(os.environ['APPDATA'], 'Litecoin') if platform.system() == 'Windows' else os.path.expanduser('~/Library/Application Support/Litecoin/') if platform.system() == 'Darwin' else os.path.expanduser('~/.litecoin'), 'litecoin.conf'),
         BLOCK_EXPLORER_URL_PREFIX='http://explorer.litecoin.net/block/',
         ADDRESS_EXPLORER_URL_PREFIX='http://explorer.litecoin.net/address/',
+        TX_EXPLORER_URL_PREFIX='http://explorer.litecoin.net/tx/',
         SANE_TARGET_RANGE=(2**256//1000000000 - 1, 2**256//1000 - 1),
         DUMB_SCRYPT_DIFF=2**16,
         DUST_THRESHOLD=0.03e8,
@@ -125,6 +130,7 @@ nets = dict(
         CONF_FILE_FUNC=lambda: os.path.join(os.path.join(os.environ['APPDATA'], 'Litecoin') if platform.system() == 'Windows' else os.path.expanduser('~/Library/Application Support/Litecoin/') if platform.system() == 'Darwin' else os.path.expanduser('~/.litecoin'), 'litecoin.conf'),
         BLOCK_EXPLORER_URL_PREFIX='http://nonexistent-litecoin-testnet-explorer/block/',
         ADDRESS_EXPLORER_URL_PREFIX='http://nonexistent-litecoin-testnet-explorer/address/',
+        TX_EXPLORER_URL_PREFIX='http://nonexistent-litecoin-testnet-explorer/tx/',
         SANE_TARGET_RANGE=(2**256//1000000000 - 1, 2**256 - 1),
         DUMB_SCRYPT_DIFF=2**16,
         DUST_THRESHOLD=1e8,
@@ -146,6 +152,7 @@ nets = dict(
         CONF_FILE_FUNC=lambda: os.path.join(os.path.join(os.environ['APPDATA'], 'Terracoin') if platform.system() == 'Windows' else os.path.expanduser('~/Library/Application Support/Terracoin/') if platform.system() == 'Darwin' else os.path.expanduser('~/.terracoin'), 'terracoin.conf'),
         BLOCK_EXPLORER_URL_PREFIX='http://cryptocoinexplorer.com:3750/block/',
         ADDRESS_EXPLORER_URL_PREFIX='http://cryptocoinexplorer.com:3750/address/',
+        TX_EXPLORER_URL_PREFIX='http://cryptocoinexplorer.com:3750/tx/',
         SANE_TARGET_RANGE=(2**256//2**32//1000 - 1, 2**256//2**32 - 1),
         DUMB_SCRYPT_DIFF=1,
         DUST_THRESHOLD=1e8,
@@ -166,6 +173,7 @@ nets = dict(
         CONF_FILE_FUNC=lambda: os.path.join(os.path.join(os.environ['APPDATA'], 'Terracoin') if platform.system() == 'Windows' else os.path.expanduser('~/Library/Application Support/Terracoin/') if platform.system() == 'Darwin' else os.path.expanduser('~/.terracoin'), 'terracoin.conf'),
         BLOCK_EXPLORER_URL_PREFIX='http://cryptocoinexplorer.com:3750/testnet/block/',
         ADDRESS_EXPLORER_URL_PREFIX='http://cryptocoinexplorer.com:3750/testnet/address/',
+        TX_EXPLORER_URL_PREFIX='http://cryptocoinexplorer.com:3750/testnet/tx/',
         SANE_TARGET_RANGE=(2**256//2**32//1000 - 1, 2**256//2**32 - 1),
         DUMB_SCRYPT_DIFF=1,
         DUST_THRESHOLD=1e8,
index 48d72a2..bac76f9 100644 (file)
@@ -312,8 +312,9 @@ def get_web_root(wb, datadir_path, bitcoind_warning_var, stop_event=variable.Eve
                     hash='%064x' % share.gentx_hash,
                     coinbase=share.share_data['coinbase'].ljust(2, '\x00').encode('hex'),
                     value=share.share_data['subsidy']*1e-8,
+                    last_txout_nonce='%016x' % share.contents['last_txout_nonce'],
                 ),
-                txn_count=len(list(share.iter_transaction_hash_refs())),
+                other_transaction_hashes=['%064x' % x for x in share.get_other_tx_hashes(node.tracker)],
             ),
         )
     new_root.putChild('share', WebInterface(lambda share_hash_str: get_share(share_hash_str)))
@@ -332,6 +333,7 @@ def get_web_root(wb, datadir_path, bitcoind_warning_var, stop_event=variable.Eve
         symbol=node.net.PARENT.SYMBOL,
         block_explorer_url_prefix=node.net.PARENT.BLOCK_EXPLORER_URL_PREFIX,
         address_explorer_url_prefix=node.net.PARENT.ADDRESS_EXPLORER_URL_PREFIX,
+        tx_explorer_url_prefix=node.net.PARENT.TX_EXPLORER_URL_PREFIX,
     )))
     new_root.putChild('version', WebInterface(lambda: p2pool.__version__))
     
index 57b49e6..a0b3be1 100644 (file)
@@ -56,7 +56,7 @@
                 
                 d3.json('/current_payouts', function(pays) {
                     d3.json('/payout_addr', function(addr) {
-                        d3.select('#payout_addr').text(addr);
+                        d3.select('#payout_addr').text(addr).attr('href', currency_info.address_explorer_url_prefix + addr);
                         d3.select('#payout_amount').text(addr in pays ? pays[addr] : 0);
                     });
                     
         <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 after mining for 24 hours:  <span id="expected_payout_amount"></span> <span class="symbol"></span> per block.</p>
+        <p>Payout if a block were found NOW: <span id="payout_amount"></span> <span class="symbol"></span> to <a id="payout_addr"></a>. Expected after mining for 24 hours:  <span id="expected_payout_amount"></span> <span class="symbol"></span> per block.</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>
         
index 9d53127..f4b861e 100644 (file)
@@ -41,7 +41,9 @@
                         parent.append('a').attr('href', '#' + share.parent).text(share.parent.substr(-8));
                     var children = b.append('p');
                         children.append('span').text('Children: ');
-                        children.data(share.children).append('a').attr('href', function(c){return '#' + c}).text(function(c){return c.substr(-8)});
+                        children.selectAll().data(share.children).enter().append('span').text(' ').append('a')
+                            .attr('href', function(c){return '#' + c})
+                            .text(function(c){return c.substr(-8)});
                     b.append('p').text('Type: ' + share.type_name);
                     b.append('h2').text('Local data');
                     b.append('p').text('Verified: ' + share.local.verified);
@@ -51,7 +53,7 @@
                     b.append('p').text('Timestamp: ' + new Date(1000*share.share_data.timestamp) + ' (' + share.share_data.timestamp + ')');
                     b.append('p').text('Difficulty: ' + target_to_difficulty(share.share_data.target));
                     b.append('p').text('Minimum difficulty: ' + target_to_difficulty(share.share_data.max_target));
-                    b.append('p').text('Payout address: ' + share.share_data.payout_address);
+                    b.append('p').text('Payout address: ').append('a').text(share.share_data.payout_address).attr('href', currency_info.address_explorer_url_prefix+share.share_data.payout_address);
                     b.append('p').text('Donation amount: ' + d3.format('.3p')(share.share_data.donation));
                     b.append('p').text('Last stale: ' + share.share_data.stale_info);
                     b.append('p').text('Nonce: ' + share.share_data.nonce);
                     var block = b.append('p')
                         block.append('span').text('Hash: ')
                         block.append('a').attr('href', currency_info.block_explorer_url_prefix + share.block.hash).text(share.block.hash);
-                    b.append('p').text('Transaction count: ' + share.block.txn_count);
-                    b.append('h2').text('Header');
+                    b.append('h3').text('Header');
                     b.append('p').text('Version: ' + share.block.header.version);
                     var prevblock = b.append('p')
                         prevblock.append('span').text('Previous block: ');
                         prevblock.append('a').attr('href', currency_info.block_explorer_url_prefix + share.block.header.previous_block).text(share.block.header.previous_block);
                     b.append('p').text('Merkle root: ' + share.block.header.merkle_root);
-                    b.append('p').text('Timestamp: ' + share.block.header.timestamp);
+                    b.append('p').text('Timestamp: ' + new Date(1000*share.block.header.timestamp) + ' (' + share.block.header.timestamp + ')');
                     b.append('p').text('Difficulty: ' + target_to_difficulty(share.block.header.target));
                     b.append('p').text('Nonce: ' + share.block.header.nonce);
-                    b.append('h2').text('Generation transaction');
-                    b.append('p').text('Hash: ' + share.block.gentx.hash);
-                    b.append('p').text('Coinbase: ' + share.block.gentx.coinbase + ' ' + hex2a(share.block.gentx.coinbase));
+                    b.append('h3').text('Generation transaction');
+                    b.append('p').text('Hash: ').append('a').text(share.block.gentx.hash).attr('href', currency_info.tx_explorer_url_prefix+share.block.gentx.hash);
+                    b.append('p').text('Coinbase (hex): ' + share.block.gentx.coinbase);
+                    b.append('p').text('Coinbase (text): ' + hex2a(share.block.gentx.coinbase));
                     b.append('p').text('Value: ' + share.block.gentx.value + ' ' + currency_info.symbol);
+                    b.append('p').text('Last txout nonce (used by Stratum miners): ' + share.block.gentx.last_txout_nonce);
+                    b.append('h3').text('Other transactions');
+                    b.append('p').selectAll().data(share.block.other_transaction_hashes).enter().append('span').text(' ').append('a')
+                            .attr('href', function(tx_hash){return currency_info.tx_explorer_url_prefix + tx_hash})
+                            .text(function(tx_hash, i){return i+1});
                     return true;
                 });
             }