electrum

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

commit 0be73ed546abbffd35856311c30f1cad841f5d0c
parent 5284aef8209cbcfa39635d5fd36c0d6d00a2e57e
Author: SomberNight <somber.night@protonmail.com>
Date:   Tue, 24 Apr 2018 15:26:56 +0200

wallet.py: small optimisation for get_wallet_delta

Diffstat:
Mlib/wallet.py | 15+++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/lib/wallet.py b/lib/wallet.py @@ -541,20 +541,19 @@ class Abstract_Wallet(PrintError): def get_wallet_delta(self, tx): """ effect of tx on wallet """ - addresses = self.get_addresses() - is_relevant = False + is_relevant = False # "related to wallet?" is_mine = False is_pruned = False is_partial = False v_in = v_out = v_out_mine = 0 - for item in tx.inputs(): - addr = item.get('address') - if addr in addresses: + for txin in tx.inputs(): + addr = txin.get('address') + if self.is_mine(addr): is_mine = True is_relevant = True - d = self.txo.get(item['prevout_hash'], {}).get(addr, []) + d = self.txo.get(txin['prevout_hash'], {}).get(addr, []) for n, v, cb in d: - if n == item['prevout_n']: + if n == txin['prevout_n']: value = v break else: @@ -569,7 +568,7 @@ class Abstract_Wallet(PrintError): is_partial = False for addr, value in tx.get_outputs(): v_out += value - if addr in addresses: + if self.is_mine(addr): v_out_mine += value is_relevant = True if is_pruned: