From f81816d788b2c91f29ac52d0c60e232a67c91449 Mon Sep 17 00:00:00 2001 From: Cryp Toon Date: Sat, 13 Jul 2024 09:59:52 +0200 Subject: [PATCH] Fix encoding type for coinbase legacy transaction from Cache --- bitcoinlib/services/services.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bitcoinlib/services/services.py b/bitcoinlib/services/services.py index 421255e4..c5a40486 100644 --- a/bitcoinlib/services/services.py +++ b/bitcoinlib/services/services.py @@ -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(),