def bump_fee(
            self,
            *,
            tx: Transaction,
            new_fee_rate: Union[int, float, Decimal],
            coins: Sequence[PartialTxInput] = None,
            strategy: BumpFeeStrategy = BumpFeeStrategy.PRESERVE_PAYMENT,
    ) -> PartialTransaction:
        """Increase the miner fee of 'tx'.
        'new_fee_rate' is the target min rate in sat/vbyte
        'coins' is a list of UTXOs we can choose from as potential new inputs to be added

        note: it is the caller's responsibility to have already called tx.add_info_from_network().
              Without that, all txins must be ismine.
        """
        assert tx
        if not isinstance(tx, PartialTransaction):
            tx = PartialTransaction.from_tx(tx)
        assert isinstance(tx, PartialTransaction)
        tx.remove_signatures()
        if not self.can_rbf_tx(tx):
            raise CannotBumpFee(_('Transaction is final'))
        new_fee_rate = quantize_feerate(new_fee_rate)  # strip excess precision
        tx.add_info_from_wallet(self)
        if tx.is_missing_info_from_network():
            raise Exception("tx missing info from network")
        old_tx_size = tx.estimated_size()
        old_fee = tx.get_fee()
        assert old_fee is not None
        old_fee_rate = old_fee / old_tx_size  # sat/vbyte
        if new_fee_rate <= old_fee_rate:
            raise CannotBumpFee(_("The new fee rate needs to be higher than the old fee rate."))

        if strategy == BumpFeeStrategy.PRESERVE_PAYMENT:
            # FIXME: we should try decreasing change first,
            # but it requires updating a bunch of unit tests
            try:
                tx_new = self._bump_fee_through_coinchooser(
                    tx=tx,
                    new_fee_rate=new_fee_rate,
                    coins=coins,
                )
            except CannotBumpFee as e:
                tx_new = self._bump_fee_through_decreasing_change(
                    tx=tx, new_fee_rate=new_fee_rate)
        elif strategy == BumpFeeStrategy.DECREASE_PAYMENT:
            tx_new = self._bump_fee_through_decreasing_payment(
                tx=tx, new_fee_rate=new_fee_rate)
        else:
            raise Exception(f"unknown strategy: {strategy=}")

        target_min_fee = new_fee_rate * tx_new.estimated_size()
        actual_fee = tx_new.get_fee()
        if actual_fee + 1 < target_min_fee:
            raise CannotBumpFee(
                f"bump_fee fee target was not met. "
                f"got {actual_fee}, expected >={target_min_fee}. "
                f"target rate was {new_fee_rate}")
        tx_new.locktime = get_locktime_for_new_transaction(self.network)
        tx_new.add_info_from_wallet(self)
        return tx_new
Increase the miner fee of 'tx'.
        'new_fee_rate' is the target min rate in sat/vbyte
        'coins' is a list of UTXOs we can choose from as potential new inputs to be added

        note: it is the caller's responsibility to have already called tx.add_info_from_network().
              Without that, all txins must be ismine.
        
electrum/wallet.py