Skip to content

Commit 1a1b7ff

Browse files
committed
rpc: wrappers for getbestblockhash, getmininginfo
Resolves #73
1 parent 0134cd3 commit 1a1b7ff

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

bitcoin/rpc.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,10 @@ def getbalance(self, account='*', minconf=1):
302302
r = self._call('getbalance', account, minconf)
303303
return int(r*COIN)
304304

305+
def getbestblockhash(self):
306+
"""Return hash of best (tip) block in longest block chain."""
307+
return lx(self._call('getbestblockhash'))
308+
305309
def getblock(self, block_hash):
306310
"""Get block <block_hash>
307311
@@ -331,13 +335,17 @@ def getblockhash(self, height):
331335
(self.__class__.__name__, ex.error['message'], ex.error['code']))
332336

333337
def getinfo(self):
334-
"""Return an object containing various state info"""
338+
"""Return a JSON object containing various state info"""
335339
r = self._call('getinfo')
336340
if 'balance' in r:
337341
r['balance'] = int(r['balance'] * COIN)
338342
r['paytxfee'] = int(r['paytxfee'] * COIN)
339343
return r
340344

345+
def getmininginfo(self):
346+
"""Return a JSON object containing mining-related information"""
347+
return self._call('getmininginfo')
348+
341349
def getnewaddress(self, account=None):
342350
"""Return a new Bitcoin address for receiving payments.
343351

0 commit comments

Comments
 (0)