Skip to content

Commit 98e0419

Browse files
committed
add minconf to getbalance
allows to filter for minimum confirmations on a account balance
1 parent 37fc01b commit 98e0419

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/bitcoin/connection.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -366,19 +366,22 @@ def validateaddress(self, validateaddress):
366366
except JSONRPCException,e:
367367
raise _wrap_exception(e.error)
368368

369-
def getbalance(self, account=None):
369+
def getbalance(self, account=None, minconf=None):
370370
"""
371371
Get the current balance, either for an account or the total server balance.
372372
373373
Arguments:
374374
- *account* -- If this parameter is specified, returns the balance in the account.
375+
- *minconf* -- Minimum number of confirmations required for transferred balance.
375376
376377
"""
378+
args = []
379+
if account:
380+
args.append(account)
381+
if minconf is not None:
382+
args.append(minconf)
377383
try:
378-
if account is None:
379-
return self.proxy.getbalance()
380-
else:
381-
return self.proxy.getbalance(account)
384+
return self.proxy.getbalance(*args)
382385
except JSONRPCException,e:
383386
raise _wrap_exception(e.error)
384387

0 commit comments

Comments
 (0)