From 4801a4a5164217be46d6786f160ba453c74b961d Mon Sep 17 00:00:00 2001 From: Bryan Bishop Date: Mon, 8 Jun 2015 14:05:23 -0500 Subject: fix block range --- rpcblockchainexplorer/api.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/rpcblockchainexplorer/api.py b/rpcblockchainexplorer/api.py index d759e04..e828f4c 100644 --- a/rpcblockchainexplorer/api.py +++ b/rpcblockchainexplorer/api.py @@ -28,6 +28,9 @@ from bitcoin.core import ( # bytes to hex b2x, + + # hex to bytes + x, ) # because of the interwebs... @@ -186,11 +189,11 @@ def index(): blockcount = g.bitcoin_rpc_client.getblockcount() - for block_index in range(0, blockcount): + for block_index in range(0, blockcount + 1): blockhash = g.bitcoin_rpc_client.getblockhash(block_index) blocks.append({ "height": block_index, - "hash": blockhash, + "hash": b2lx(blockhash), }) return render_template("blocks.html", blocks=blocks) @@ -209,7 +212,7 @@ def _getblock(blockhash): @api.route("/transaction/") def _transaction(txid): - transaction = g.bitcoin_rpc_client._call("getrawtransaction", b2x(x(txid)), 1) + transaction = g.bitcoin_rpc_client._call("getrawtransaction", txid, 1) blockhash = transaction["blockhash"] del transaction["blockhash"] return render_template("transaction.html", transaction=transaction, blockhash=blockhash) -- cgit v1.2.3