Fixed up z->t transactions

This commit is contained in:
Chris Sulmone 2018-02-01 21:00:26 -06:00
parent 02e970f34f
commit e5a8782fe5
2 changed files with 3 additions and 18 deletions

View File

@ -463,26 +463,9 @@ def deserialize(raw):
start = vds.read_cursor
d['version'] = vds.read_int32()
n_vin = vds.read_compact_size()
is_segwit = (n_vin == 0)
if is_segwit:
marker = vds.read_bytes(1)
assert marker == b'\x01'
n_vin = vds.read_compact_size()
d['inputs'] = [parse_input(vds) 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)
# segwit-native script
if not txin.get('scriptSig'):
if txin['num_sig'] == 1:
txin['type'] = 'p2wpkh'
txin['address'] = bitcoin.public_key_to_p2wpkh(bfh(txin['pubkeys'][0]))
else:
txin['type'] = 'p2wsh'
txin['address'] = bitcoin.script_to_p2wsh(txin['witnessScript'])
d['lockTime'] = vds.read_uint32()
return d

View File

@ -662,7 +662,9 @@ class Abstract_Wallet(PrintError):
return addr
def add_transaction(self, tx_hash, tx):
is_coinbase = tx.inputs()[0]['type'] == 'coinbase'
is_shielded_input = len(tx.inputs()) == 0
is_coinbase = not is_shielded_input and tx.inputs()[0]['type'] == 'coinbase'
with self.transaction_lock:
# add inputs
self.txi[tx_hash] = d = {}