1
0

gui: cpfp: calc parent fee for cpfp using wallet.get_tx_info

I am only making this change as it makes it simpler to do manual testing of CPFP-ing *local* txs.
That is, by changing a few easy-to-find lines of code, I can make the GUI allow CPFP-ing a local tx, but
without this change it errors out with "unknown fee for parent transaction".

If one has an incoming local tx saved in the wallet, adb.get_tx_fee(txid) returns None
(if the tx gets into the mempool, it will use the server-reported value instead).
In contrast, wallet.get_tx_info(tx).fee calls both wallet.get_wallet_delta(tx) and adb.get_tx_fee(txid),
making it more expensive but more complete.
This commit is contained in:
SomberNight
2023-12-29 02:55:11 +00:00
parent ceb42c2a1b
commit eee61a98cb
3 changed files with 3 additions and 2 deletions

View File

@@ -757,6 +757,7 @@ class AddressSynchronizer(Logger, EventListener):
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).
More expensive but more complete alternative: wallet.get_tx_info(tx).fee
"""
# check if stored fee is available
fee = self.db.get_tx_fee(txid, trust_server=False)

View File

@@ -755,7 +755,7 @@ class QETxCpfpFeeBumper(TxFeeSlider, TxMonMixin):
return
self._parent_tx_size = self._parent_tx.estimated_size()
self._parent_fee = self._wallet.wallet.adb.get_tx_fee(self._txid)
self._parent_fee = self._wallet.wallet.get_tx_info(self._parent_tx).fee
if self._parent_fee is None:
self._logger.error(_("Can't CPFP: unknown fee for parent transaction."))

View File

@@ -2546,7 +2546,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger, QtEventListener):
total_size = parent_tx.estimated_size() + new_tx.estimated_size()
parent_txid = parent_tx.txid()
assert parent_txid
parent_fee = self.wallet.adb.get_tx_fee(parent_txid)
parent_fee = self.wallet.get_tx_info(parent_tx).fee
if parent_fee is None:
self.show_error(_("Can't CPFP: unknown fee for parent transaction."))
return