From 703ec0935540afe07c30b71be5517a974a721bc3 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Tue, 13 Jun 2023 00:24:56 +0000 Subject: [PATCH] addr_sync: expand docstring for get_tx_fee --- electrum/address_synchronizer.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/electrum/address_synchronizer.py b/electrum/address_synchronizer.py index b42be0474..bfb46b324 100644 --- a/electrum/address_synchronizer.py +++ b/electrum/address_synchronizer.py @@ -742,7 +742,14 @@ class AddressSynchronizer(Logger, EventListener): return delta def get_tx_fee(self, txid: str) -> Optional[int]: - """ Returns tx_fee or None. Use server fee only if tx is unconfirmed and not mine""" + """Returns tx_fee or None. Use server fee only if tx is unconfirmed and not mine. + + Note: being fast is prioritised over completeness here. We try to avoid deserializing + the tx, as that is expensive if we are called for the whole history. We sometimes + incorrectly early-exit and return None, e.g. for not-all-ismine-input txs, + where we could calculate the fee if we deserialized (but to see if we have all + the parent txs available, we would have to deserialize first). + """ # check if stored fee is available fee = self.db.get_tx_fee(txid, trust_server=False) if fee is not None: