mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-30 17:01:34 +00:00
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
This commit is contained in:
parent
59c1d03f01
commit
ad7f8f2cbe
1 changed files with 3 additions and 0 deletions
|
@ -714,6 +714,7 @@ class Abstract_Wallet(PrintError):
|
||||||
coins = []
|
coins = []
|
||||||
if domain is None:
|
if domain is None:
|
||||||
domain = self.get_addresses()
|
domain = self.get_addresses()
|
||||||
|
domain = set(domain)
|
||||||
if exclude_frozen:
|
if exclude_frozen:
|
||||||
domain = set(domain) - self.frozen_addresses
|
domain = set(domain) - self.frozen_addresses
|
||||||
for addr in domain:
|
for addr in domain:
|
||||||
|
@ -742,6 +743,7 @@ class Abstract_Wallet(PrintError):
|
||||||
def get_balance(self, domain=None):
|
def get_balance(self, domain=None):
|
||||||
if domain is None:
|
if domain is None:
|
||||||
domain = self.get_addresses()
|
domain = self.get_addresses()
|
||||||
|
domain = set(domain)
|
||||||
cc = uu = xx = 0
|
cc = uu = xx = 0
|
||||||
for addr in domain:
|
for addr in domain:
|
||||||
c, u, x = self.get_addr_balance(addr)
|
c, u, x = self.get_addr_balance(addr)
|
||||||
|
@ -990,6 +992,7 @@ class Abstract_Wallet(PrintError):
|
||||||
# get domain
|
# get domain
|
||||||
if domain is None:
|
if domain is None:
|
||||||
domain = self.get_addresses()
|
domain = self.get_addresses()
|
||||||
|
domain = set(domain)
|
||||||
# 1. Get the history of each address in the domain, maintain the
|
# 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
|
# delta of a tx as the sum of its deltas on domain addresses
|
||||||
tx_deltas = defaultdict(int)
|
tx_deltas = defaultdict(int)
|
||||||
|
|
Loading…
Add table
Reference in a new issue