twallet.py: fix balance/history for duplicate addresses - electrum - Electrum Bitcoin wallet
HTML git clone https://git.parazyd.org/electrum
DIR Log
DIR Files
DIR Refs
DIR Submodules
---
DIR commit ad7f8f2cbe822622582952ba81ca65eef6b97cd5
DIR parent 59c1d03f018026ac301c4e74facfc64da8ae4708
HTML 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:
M lib/wallet.py | 3 +++
1 file changed, 3 insertions(+), 0 deletions(-)
---
DIR diff --git a/lib/wallet.py b/lib/wallet.py
t@@ -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:
t@@ -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)
t@@ -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)