Browse Source
transaction.deserialize: only set self._inputs after parsing witness
re multi-threaded sanity...
(see lazy deserialization in Transaction.inputs)
patch-4
SomberNight
3 years ago
No known key found for this signature in database
GPG Key ID: B33B5F232C6271E9
1 changed files with
3 additions and
2 deletions
-
electrum/transaction.py
|
|
@ -675,14 +675,15 @@ class Transaction: |
|
|
|
n_vin = vds.read_compact_size() |
|
|
|
if n_vin < 1: |
|
|
|
raise SerializationError('tx needs to have at least 1 input') |
|
|
|
self._inputs = [parse_input(vds) for i in range(n_vin)] |
|
|
|
txins = [parse_input(vds) for i in range(n_vin)] |
|
|
|
n_vout = vds.read_compact_size() |
|
|
|
if n_vout < 1: |
|
|
|
raise SerializationError('tx needs to have at least 1 output') |
|
|
|
self._outputs = [parse_output(vds) for i in range(n_vout)] |
|
|
|
if is_segwit: |
|
|
|
for txin in self._inputs: |
|
|
|
for txin in txins: |
|
|
|
parse_witness(vds, txin) |
|
|
|
self._inputs = txins # only expose field after witness is parsed, for sanity |
|
|
|
self._locktime = vds.read_uint32() |
|
|
|
if vds.can_read_more(): |
|
|
|
raise SerializationError('extra junk at the end') |
|
|
|