diff --git a/electrum/gui/qt/confirm_tx_dialog.py b/electrum/gui/qt/confirm_tx_dialog.py index 7f3baaec1..80c2f8e98 100644 --- a/electrum/gui/qt/confirm_tx_dialog.py +++ b/electrum/gui/qt/confirm_tx_dialog.py @@ -567,8 +567,7 @@ class TxEditor(WindowModalDialog): if any(txin.block_height<=0 for txin in self.tx.inputs()): warnings.append(_('This transaction spends unconfirmed coins.')) # warn if we merge from mempool - base_tx = self.wallet.get_unconfirmed_base_tx_for_batching() - if self.config.get('batch_rbf', False) and base_tx: + if self.tx.rbf_merge_txid: warnings.append(_('This payment was merged with another existing transaction.')) # TODO: warn if we send change back to input address self.warning = _('Warning') + ': ' + '\n'.join(warnings) if warnings else '' diff --git a/electrum/transaction.py b/electrum/transaction.py index 3e1ff536b..0a7dccbad 100644 --- a/electrum/transaction.py +++ b/electrum/transaction.py @@ -1651,6 +1651,7 @@ class PartialTransaction(Transaction): self._inputs = [] # type: List[PartialTxInput] self._outputs = [] # type: List[PartialTxOutput] self._unknown = {} # type: Dict[bytes, bytes] + self.rbf_merge_txid = None def to_json(self) -> dict: d = super().to_json() diff --git a/electrum/wallet.py b/electrum/wallet.py index 48ebc9e84..095e3453c 100644 --- a/electrum/wallet.py +++ b/electrum/wallet.py @@ -1664,6 +1664,9 @@ class Abstract_Wallet(ABC, Logger, EventListener): else: raise Exception(f'Invalid argument fee: {fee}') + # set if we merge with another transaction + rbf_merge_txid = None + if len(i_max) == 0: # Let the coin chooser select the coins to spend coin_chooser = coinchooser.get_coin_chooser(self.config) @@ -1686,6 +1689,7 @@ class Abstract_Wallet(ABC, Logger, EventListener): txi = base_tx.inputs() txo = list(filter(lambda o: not self.is_change(o.address), base_tx.outputs())) old_change_addrs = [o.address for o in base_tx.outputs() if self.is_change(o.address)] + rbf_merge_txid = base_tx.txid() else: txi = [] txo = [] @@ -1727,6 +1731,7 @@ class Abstract_Wallet(ABC, Logger, EventListener): # Timelock tx to current height. tx.locktime = get_locktime_for_new_transaction(self.network) + tx.rbf_merge_txid = rbf_merge_txid tx.set_rbf(rbf) tx.add_info_from_wallet(self) run_hook('make_unsigned_transaction', self, tx)