URI: 
       tfix RBF - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 1b834a7a7887af7f67952b7152928b62484a806b
   DIR parent 8f7a4cf876c3eb9ec5669ec3dd068a7a819636de
  HTML Author: SomberNight <somber.night@protonmail.com>
       Date:   Thu, 14 Jun 2018 22:19:06 +0200
       
       fix RBF
       
       Diffstat:
         M gui/qt/main_window.py               |       3 ++-
         M lib/transaction.py                  |      13 +++++++------
         M lib/wallet.py                       |       2 ++
       
       3 files changed, 11 insertions(+), 7 deletions(-)
       ---
   DIR diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py
       t@@ -3166,7 +3166,8 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
                try:
                    new_tx = self.wallet.bump_fee(tx, delta)
                except BaseException as e:
       -            self.show_error(str(e))
       +            traceback.print_exc(file=sys.stderr)
       +            self.show_error(_('Error bumping fee') + ':\n' + str(e))
                    return
                if is_final:
                    new_tx.set_rbf(False)
   DIR diff --git a/lib/transaction.py b/lib/transaction.py
       t@@ -495,7 +495,7 @@ def parse_witness(vds, txin, full_parse: bool):
                return
        
            try:
       -        if txin['witness_version'] != 0:
       +        if txin.get('witness_version', 0) != 0:
                    raise UnknownTxinType()
                if txin['type'] == 'coinbase':
                    pass
       t@@ -545,7 +545,7 @@ def parse_output(vds, i):
            return d
        
        
       -def deserialize(raw: str) -> dict:
       +def deserialize(raw: str, force_full_parse=False) -> dict:
            raw_bytes = bfh(raw)
            d = {}
            if raw_bytes[:5] == PARTIAL_TXN_HEADER_MAGIC:
       t@@ -557,6 +557,7 @@ def deserialize(raw: str) -> dict:
                raw_bytes = raw_bytes[6:]
            else:
                d['partial'] = is_partial = False
       +    full_parse = force_full_parse or is_partial
            vds = BCDataStream()
            vds.write(raw_bytes)
            d['version'] = vds.read_int32()
       t@@ -568,13 +569,13 @@ def deserialize(raw: str) -> dict:
                    raise ValueError('invalid txn marker byte: {}'.format(marker))
                n_vin = vds.read_compact_size()
            d['segwit_ser'] = is_segwit
       -    d['inputs'] = [parse_input(vds, full_parse=is_partial) for i in range(n_vin)]
       +    d['inputs'] = [parse_input(vds, full_parse=full_parse) for i in range(n_vin)]
            n_vout = vds.read_compact_size()
            d['outputs'] = [parse_output(vds, i) for i in range(n_vout)]
            if is_segwit:
                for i in range(n_vin):
                    txin = d['inputs'][i]
       -            parse_witness(vds, txin, full_parse=is_partial)
       +            parse_witness(vds, txin, full_parse=full_parse)
            d['lockTime'] = vds.read_uint32()
            if vds.can_read_more():
                raise SerializationError('extra junk at the end')
       t@@ -696,13 +697,13 @@ class Transaction:
                txin['scriptSig'] = None  # force re-serialization
                txin['witness'] = None    # force re-serialization
        
       -    def deserialize(self):
       +    def deserialize(self, force_full_parse=False):
                if self.raw is None:
                    return
                    #self.raw = self.serialize()
                if self._inputs is not None:
                    return
       -        d = deserialize(self.raw)
       +        d = deserialize(self.raw, force_full_parse)
                self._inputs = d['inputs']
                self._outputs = [(x['type'], x['address'], x['value']) for x in d['outputs']]
                self.locktime = d['lockTime']
   DIR diff --git a/lib/wallet.py b/lib/wallet.py
       t@@ -1378,6 +1378,8 @@ class Abstract_Wallet(PrintError):
            def bump_fee(self, tx, delta):
                if tx.is_final():
                    raise Exception(_('Cannot bump fee') + ': ' + _('transaction is final'))
       +        tx = Transaction(tx.serialize())
       +        tx.deserialize(force_full_parse=True)  # need to parse inputs
                inputs = copy.deepcopy(tx.inputs())
                outputs = copy.deepcopy(tx.outputs())
                for txin in inputs: