diff options
author | Bryan Bishop <kanzure@gmail.com> | 2015-06-08 14:05:23 -0500 |
---|---|---|
committer | Bryan Bishop <kanzure@gmail.com> | 2015-06-08 14:05:23 -0500 |
commit | 4801a4a5164217be46d6786f160ba453c74b961d (patch) | |
tree | 23e3773e1b3f421fbadc7f4bccbb45ea1e3d83c1 | |
parent | 3706accf931ee49269d5f4e701680763f5ea6d19 (diff) | |
download | rpcblockchainexplorer-4801a4a5164217be46d6786f160ba453c74b961d.tar.gz rpcblockchainexplorer-4801a4a5164217be46d6786f160ba453c74b961d.zip |
fix block range
-rw-r--r-- | rpcblockchainexplorer/api.py | 9 |
1 files 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/<txid>") 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) |