electrum

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

commit e71fa4924f01210c9144e4d5c31fea01eb5056e5
parent 8b2eb83238905fdbc781f042b8912ba9d7f45f37
Author: SomberNight <somber.night@protonmail.com>
Date:   Fri, 16 Oct 2020 21:25:11 +0200

wallet: rm wallet.txin_value

Diffstat:
Melectrum/address_synchronizer.py | 2++
Melectrum/wallet.py | 16+---------------
2 files changed, 3 insertions(+), 15 deletions(-)

diff --git a/electrum/address_synchronizer.py b/electrum/address_synchronizer.py @@ -149,6 +149,8 @@ class AddressSynchronizer(Logger): return txin.value_sats() prevout_hash = txin.prevout.txid.hex() prevout_n = txin.prevout.out_idx + if address is None: + address = self.get_txin_address(txin) if address: d = self.db.get_txo_addr(prevout_hash, address) for n, v, cb in d: diff --git a/electrum/wallet.py b/electrum/wallet.py @@ -2049,20 +2049,6 @@ class Abstract_Wallet(AddressSynchronizer, ABC): def pubkeys_to_address(self, pubkeys: Sequence[str]) -> Optional[str]: pass - def txin_value(self, txin: TxInput) -> Optional[int]: - if isinstance(txin, PartialTxInput): - v = txin.value_sats() - if v: return v - txid = txin.prevout.txid.hex() - prev_n = txin.prevout.out_idx - for addr in self.db.get_txo_addresses(txid): - d = self.db.get_txo_addr(txid, addr) - for n, v, cb in d: - if n == prev_n: - return v - # may occur if wallet is not synchronized - return None - def price_at_timestamp(self, txid, price_func): """Returns fiat price of bitcoin at the time tx got confirmed.""" timestamp = self.get_tx_height(txid).timestamp @@ -2072,7 +2058,7 @@ class Abstract_Wallet(AddressSynchronizer, ABC): coins = self.get_utxos(domain) now = time.time() p = price_func(now) - ap = sum(self.coin_price(coin.prevout.txid.hex(), price_func, ccy, self.txin_value(coin)) for coin in coins) + ap = sum(self.coin_price(coin.prevout.txid.hex(), price_func, ccy, self.get_txin_value(coin)) for coin in coins) lp = sum([coin.value_sats() for coin in coins]) * p / Decimal(COIN) return lp - ap