SomberNight
5 years ago
No known key found for this signature in database
GPG Key ID: B33B5F232C6271E9
3 changed files with
18 additions and
4 deletions
-
electrum/address_synchronizer.py
-
electrum/transaction.py
-
electrum/wallet.py
|
|
@ -31,7 +31,7 @@ from typing import TYPE_CHECKING, Dict, Optional, Set, Tuple, NamedTuple, Sequen |
|
|
|
from . import bitcoin |
|
|
|
from .bitcoin import COINBASE_MATURITY |
|
|
|
from .util import profiler, bfh, TxMinedInfo |
|
|
|
from .transaction import Transaction, TxOutput, TxInput, PartialTxInput, TxOutpoint |
|
|
|
from .transaction import Transaction, TxOutput, TxInput, PartialTxInput, TxOutpoint, PartialTransaction |
|
|
|
from .synchronizer import Synchronizer |
|
|
|
from .verifier import SPV |
|
|
|
from .blockchain import hash_header |
|
|
@ -650,6 +650,8 @@ class AddressSynchronizer(Logger): |
|
|
|
break |
|
|
|
else: |
|
|
|
value = None |
|
|
|
if value is None: |
|
|
|
value = txin.value_sats() |
|
|
|
if value is None: |
|
|
|
is_pruned = True |
|
|
|
else: |
|
|
|
|
|
@ -81,6 +81,10 @@ class MalformedBitcoinScript(Exception): |
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
class MissingTxInputAmount(Exception): |
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
SIGHASH_ALL = 1 |
|
|
|
|
|
|
|
|
|
|
@ -1605,13 +1609,19 @@ class PartialTransaction(Transaction): |
|
|
|
self.invalidate_ser_cache() |
|
|
|
|
|
|
|
def input_value(self) -> int: |
|
|
|
return sum(txin.value_sats() for txin in self.inputs()) |
|
|
|
input_values = [txin.value_sats() for txin in self.inputs()] |
|
|
|
if any([val is None for val in input_values]): |
|
|
|
raise MissingTxInputAmount() |
|
|
|
return sum(input_values) |
|
|
|
|
|
|
|
def output_value(self) -> int: |
|
|
|
return sum(o.value for o in self.outputs()) |
|
|
|
|
|
|
|
def get_fee(self) -> int: |
|
|
|
return self.input_value() - self.output_value() |
|
|
|
def get_fee(self) -> Optional[int]: |
|
|
|
try: |
|
|
|
return self.input_value() - self.output_value() |
|
|
|
except MissingTxInputAmount: |
|
|
|
return None |
|
|
|
|
|
|
|
def serialize_preimage(self, txin_index: int, *, |
|
|
|
bip143_shared_txdigest_fields: BIP143SharedTxDigestFields = None) -> str: |
|
|
|
|
|
@ -457,6 +457,8 @@ class Abstract_Wallet(AddressSynchronizer): |
|
|
|
|
|
|
|
def get_tx_info(self, tx) -> TxWalletDetails: |
|
|
|
is_relevant, is_mine, v, fee = self.get_wallet_delta(tx) |
|
|
|
if fee is None and isinstance(tx, PartialTransaction): |
|
|
|
fee = tx.get_fee() |
|
|
|
exp_n = None |
|
|
|
can_broadcast = False |
|
|
|
can_bump = False |
|
|
|