Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions bitcoin/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,13 +509,21 @@ def getblockhash(self, height):
(self.__class__.__name__, ex.error['message'], ex.error['code']))

def getinfo(self):
try:
"""Return a JSON object containing various state info"""
r = self._call('getinfo')
if 'balance' in r:
r['balance'] = int(r['balance'] * COIN)
if 'paytxfee' in r:
r['paytxfee'] = int(r['paytxfee'] * COIN)
return r
except:
print("getnetworkinfo replaces getinfo on versions > 0.16.0, please use getnetworkinfo()")
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should print to stderr or maybe call depreciationwarning or similar.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added DepreciationWarning seems to work well. Hope that works, otherwise let me know and I can add more. I'm very new to python so excuse my ignorance on some things.

return self._call('getnetworkinfo')

def getnetworkinfo(self):
"""Return a JSON object containing various state info"""
r = self._call('getinfo')
if 'balance' in r:
r['balance'] = int(r['balance'] * COIN)
if 'paytxfee' in r:
r['paytxfee'] = int(r['paytxfee'] * COIN)
return r
return self._call('getnetworkinfo')

def getmininginfo(self):
"""Return a JSON object containing mining-related information"""
Expand Down