Skip to content

Commit

Permalink
Fix encoding type for coinbase legacy transaction from Cache
Browse files Browse the repository at this point in the history
  • Loading branch information
Cryp Toon committed Jul 13, 2024
1 parent 079ccf8 commit f81816d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bitcoinlib/services/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -731,10 +731,13 @@ def _parse_db_transaction(db_tx):
t.date = t.date.replace(tzinfo=timezone.utc)
for n in db_tx.nodes:
if n.is_input:
witness_type = None
if n.ref_txid == b'\00' * 32:
t.coinbase = True
witness_type = db_tx.witness_type.value
t.add_input(n.ref_txid.hex(), n.ref_index_n, unlocking_script=n.script, address=n.address,
sequence=n.sequence, value=n.value, index_n=n.index_n, witnesses=n.witnesses, strict=False)
sequence=n.sequence, value=n.value, index_n=n.index_n, witnesses=n.witnesses,
strict=False, witness_type=witness_type)
else:
t.add_output(n.value, n.address, lock_script=n.script, spent=n.spent, output_n=n.index_n,
spending_txid=None if not n.ref_txid else n.ref_txid.hex(),
Expand Down

0 comments on commit f81816d

Please sign in to comment.