URI: 
       ttransaction.py: reserialize scriptSig for incomplete txin - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit e375bf48c48620093a76de17b48c5ee1cadee686
   DIR parent 7a27d04415d519ff73d5cf20a9360c62f9bce23b
  HTML Author: SomberNight <somber.night@protonmail.com>
       Date:   Tue, 15 May 2018 18:53:25 +0200
       
       ttransaction.py: reserialize scriptSig for incomplete txin
       
       On offline imported privkey + online imported address config, the offline wallet was displaying incorrect tx size.
       
       Diffstat:
         M lib/transaction.py                  |      14 ++++++--------
       
       1 file changed, 6 insertions(+), 8 deletions(-)
       ---
   DIR diff --git a/lib/transaction.py b/lib/transaction.py
       t@@ -101,8 +101,6 @@ class BCDataStream(object):
                except IndexError:
                    raise SerializationError("attempt to read past end of buffer")
        
       -        return ''
       -
            def read_boolean(self): return self.read_bytes(1)[0] != chr(0)
            def read_int16(self): return self._read_num('<h')
            def read_uint16(self): return self._read_num('<H')
       t@@ -458,21 +456,17 @@ def parse_input(vds):
            d['signatures'] = {}
            d['address'] = None
            d['num_sig'] = 0
       +    d['scriptSig'] = bh2u(scriptSig)
            if prevout_hash == '00'*32:
                d['type'] = 'coinbase'
       -        d['scriptSig'] = bh2u(scriptSig)
            else:
                d['type'] = 'unknown'
                if scriptSig:
       -            d['scriptSig'] = bh2u(scriptSig)
                    try:
                        parse_scriptSig(d, scriptSig)
                    except BaseException:
                        traceback.print_exc(file=sys.stderr)
                        print_error('failed to parse scriptSig', bh2u(scriptSig))
       -        else:
       -            d['scriptSig'] = ''
       -
            return d
        
        
       t@@ -804,8 +798,12 @@ class Transaction:
                if _type == 'coinbase':
                    return txin['scriptSig']
        
       +        # If there is already a saved scriptSig, just return that.
       +        # This allows manual creation of txins of any custom type.
       +        # However, if the txin is not complete, we might have some garbage
       +        # saved from our partial txn ser format, so we re-serialize then.
                script_sig = txin.get('scriptSig', None)
       -        if script_sig is not None:
       +        if script_sig is not None and self.is_txin_complete(txin):
                    return script_sig
        
                pubkeys, sig_list = self.get_siglist(txin, estimate_size)