mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-31 01:11:35 +00:00
transaction.py: reserialize scriptSig for incomplete txin
On offline imported privkey + online imported address config, the offline wallet was displaying incorrect tx size.
This commit is contained in:
parent
7a27d04415
commit
e375bf48c4
1 changed files with 6 additions and 8 deletions
|
@ -101,8 +101,6 @@ class BCDataStream(object):
|
||||||
except IndexError:
|
except IndexError:
|
||||||
raise SerializationError("attempt to read past end of buffer")
|
raise SerializationError("attempt to read past end of buffer")
|
||||||
|
|
||||||
return ''
|
|
||||||
|
|
||||||
def read_boolean(self): return self.read_bytes(1)[0] != chr(0)
|
def read_boolean(self): return self.read_bytes(1)[0] != chr(0)
|
||||||
def read_int16(self): return self._read_num('<h')
|
def read_int16(self): return self._read_num('<h')
|
||||||
def read_uint16(self): return self._read_num('<H')
|
def read_uint16(self): return self._read_num('<H')
|
||||||
|
@ -458,21 +456,17 @@ def parse_input(vds):
|
||||||
d['signatures'] = {}
|
d['signatures'] = {}
|
||||||
d['address'] = None
|
d['address'] = None
|
||||||
d['num_sig'] = 0
|
d['num_sig'] = 0
|
||||||
|
d['scriptSig'] = bh2u(scriptSig)
|
||||||
if prevout_hash == '00'*32:
|
if prevout_hash == '00'*32:
|
||||||
d['type'] = 'coinbase'
|
d['type'] = 'coinbase'
|
||||||
d['scriptSig'] = bh2u(scriptSig)
|
|
||||||
else:
|
else:
|
||||||
d['type'] = 'unknown'
|
d['type'] = 'unknown'
|
||||||
if scriptSig:
|
if scriptSig:
|
||||||
d['scriptSig'] = bh2u(scriptSig)
|
|
||||||
try:
|
try:
|
||||||
parse_scriptSig(d, scriptSig)
|
parse_scriptSig(d, scriptSig)
|
||||||
except BaseException:
|
except BaseException:
|
||||||
traceback.print_exc(file=sys.stderr)
|
traceback.print_exc(file=sys.stderr)
|
||||||
print_error('failed to parse scriptSig', bh2u(scriptSig))
|
print_error('failed to parse scriptSig', bh2u(scriptSig))
|
||||||
else:
|
|
||||||
d['scriptSig'] = ''
|
|
||||||
|
|
||||||
return d
|
return d
|
||||||
|
|
||||||
|
|
||||||
|
@ -804,8 +798,12 @@ class Transaction:
|
||||||
if _type == 'coinbase':
|
if _type == 'coinbase':
|
||||||
return txin['scriptSig']
|
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)
|
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
|
return script_sig
|
||||||
|
|
||||||
pubkeys, sig_list = self.get_siglist(txin, estimate_size)
|
pubkeys, sig_list = self.get_siglist(txin, estimate_size)
|
||||||
|
|
Loading…
Add table
Reference in a new issue