Skip to content
Open
Changes from all 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
23 changes: 17 additions & 6 deletions bitcoin/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import os
import platform
import sys
import warnings
try:
import urllib.parse as urlparse
except ImportError:
Expand Down Expand Up @@ -509,13 +510,23 @@ 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:
warnings.warn(
"getinfo is deprecated from version 0.16.0, use getnetworkinfoinstead",
DeprecationWarning
)

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