electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit ad7f8f2cbe822622582952ba81ca65eef6b97cd5
parent 59c1d03f018026ac301c4e74facfc64da8ae4708
Author: SomberNight <somber.night@protonmail.com>
Date:   Sat, 16 Jun 2018 16:38:34 +0200

wallet.py: fix balance/history for duplicate addresses

in a hd wallet, having duplicate addresses is extremely unlikely, but if it happened, previously an incorrect balance was calculated

Diffstat:
Mlib/wallet.py | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

diff --git a/lib/wallet.py b/lib/wallet.py @@ -714,6 +714,7 @@ class Abstract_Wallet(PrintError): coins = [] if domain is None: domain = self.get_addresses() + domain = set(domain) if exclude_frozen: domain = set(domain) - self.frozen_addresses for addr in domain: @@ -742,6 +743,7 @@ class Abstract_Wallet(PrintError): def get_balance(self, domain=None): if domain is None: domain = self.get_addresses() + domain = set(domain) cc = uu = xx = 0 for addr in domain: c, u, x = self.get_addr_balance(addr) @@ -990,6 +992,7 @@ class Abstract_Wallet(PrintError): # get domain if domain is None: domain = self.get_addresses() + domain = set(domain) # 1. Get the history of each address in the domain, maintain the # delta of a tx as the sum of its deltas on domain addresses tx_deltas = defaultdict(int)