From fb1e69bf13ff677bc9f79ebb49d8d0e838502375 Mon Sep 17 00:00:00 2001 From: Forrest Voight Date: Thu, 3 May 2012 17:42:50 -0400 Subject: [PATCH] fixed address link going to block explorer page --- p2pool/bitcoin/networks.py | 6 ++++++ p2pool/web.py | 6 +++++- web-static/index.html | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/p2pool/bitcoin/networks.py b/p2pool/bitcoin/networks.py index 3e85e2f..aa86224 100644 --- a/p2pool/bitcoin/networks.py +++ b/p2pool/bitcoin/networks.py @@ -21,6 +21,7 @@ nets = dict( SYMBOL='BTC', 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/block/', + ADDRESS_EXPLORER_URL_PREFIX='http://blockexplorer.com/address/', SANE_MAX_TARGET=2**256//2**32 - 1, ), bitcoin_testnet=math.Object( @@ -37,6 +38,7 @@ nets = dict( SYMBOL='tBTC', 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/', SANE_MAX_TARGET=2**256//2**32 - 1, ), @@ -54,6 +56,7 @@ nets = dict( SYMBOL='NMC', 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/', SANE_MAX_TARGET=2**256//2**32 - 1, ), namecoin_testnet=math.Object( @@ -70,6 +73,7 @@ nets = dict( SYMBOL='tNMC', 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/', SANE_MAX_TARGET=2**256//2**32 - 1, ), @@ -87,6 +91,7 @@ nets = dict( SYMBOL='LTC', 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://abe.liteco.in/block/', + ADDRESS_EXPLORER_URL_PREFIX='http://abe.liteco.in/address/', SANE_MAX_TARGET=2**256//1000 - 1, ), litecoin_testnet=math.Object( @@ -103,6 +108,7 @@ nets = dict( SYMBOL='tLTC', 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/', SANE_MAX_TARGET=2**256//1000 - 1, ), ) diff --git a/p2pool/web.py b/p2pool/web.py index ceb8c74..78f60d5 100644 --- a/p2pool/web.py +++ b/p2pool/web.py @@ -295,7 +295,11 @@ def get_web_root(tracker, current_work, current_work2, get_current_txouts, datad new_root.putChild('tails', WebInterface(lambda: ['%064x' % x for t in tracker.tails for x in tracker.reverse_shares.get(t, set())])) new_root.putChild('verified_tails', WebInterface(lambda: ['%064x' % x for t in tracker.verified.tails for x in tracker.verified.reverse_shares.get(t, set())])) new_root.putChild('best_share_hash', WebInterface(lambda: '%064x' % current_work.value['best_share_hash'])) - new_root.putChild('currency_info', WebInterface(lambda: dict(symbol=net.PARENT.SYMBOL, block_explorer_url_prefix=net.PARENT.BLOCK_EXPLORER_URL_PREFIX))) + new_root.putChild('currency_info', WebInterface(lambda: dict( + symbol=net.PARENT.SYMBOL, + block_explorer_url_prefix=net.PARENT.BLOCK_EXPLORER_URL_PREFIX, + address_explorer_url_prefix=net.PARENT.ADDRESS_EXPLORER_URL_PREFIX, + ))) class Explorer(resource.Resource): def render_GET(self, request): diff --git a/web-static/index.html b/web-static/index.html index 4ae4b21..f88243d 100644 --- a/web-static/index.html +++ b/web-static/index.html @@ -50,7 +50,7 @@ var arr = []; for(var i in pays) arr.push(i); arr.sort(function(a, b){return pays[b] - pays[a]}); var tr = d3.select('#payouts').selectAll().data(arr).enter().append('tr'); - tr.append('td').append('a').text(function(addr){return addr}).attr('href', function(addr){return currency_info.block_explorer_url_prefix + addr}); + tr.append('td').append('a').text(function(addr){return addr}).attr('href', function(addr){return currency_info.address_explorer_url_prefix + addr}); tr.append('td').text(function(addr){return pays[addr]}); var total_tr = d3.select('#payouts').append('tr'); -- 1.7.1