Add wallet function get_addr_received()

This commit is contained in:
Kausheel Kumar 2015-04-09 01:44:44 +10:00
parent 42ed67e8c7
commit 8cf793ab98
1 changed files with 10 additions and 0 deletions

View File

@ -487,6 +487,16 @@ class Abstract_Wallet(object):
coins.pop(txi)
return coins.items()
#return the total amount ever received by an address
def get_addr_received(self, address):
h = self.history.get(address, [])
received = 0
for tx_hash, height in h:
l = self.txo.get(tx_hash, {}).get(address, [])
for n, v, is_cb in l:
received += v
return received
def get_addr_balance(self, address):
"returns the confirmed balance and pending (unconfirmed) balance change of a bitcoin address"
coins = self.get_addr_utxo(address)