From 8cf793ab9862f0c64b0da916c0024bc0088f93ea Mon Sep 17 00:00:00 2001 From: Kausheel Kumar Date: Thu, 9 Apr 2015 01:44:44 +1000 Subject: [PATCH] Add wallet function get_addr_received() --- lib/wallet.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/wallet.py b/lib/wallet.py index 549f6089..f4ed4c2f 100644 --- a/lib/wallet.py +++ b/lib/wallet.py @@ -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)