Skip to content

Commit 8135a5b

Browse files
authored
Merge pull request #83 from 0xB10C/2020-09-deduplicate-transaction-hash-fun
remove: de-duplicate the Transaction.hash() function
2 parents 817ed3e + 5827771 commit 8135a5b

File tree

1 file changed

+0
-16
lines changed

1 file changed

+0
-16
lines changed

blockchain_parser/transaction.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -102,22 +102,6 @@ def locktime(self):
102102
self._locktime = decode_uint32(self.hex[-4:])
103103
return self._locktime
104104

105-
@property
106-
def hash(self):
107-
"""Returns the transaction's hash"""
108-
if self._hash is None:
109-
# segwit transactions have two transaction ids/hashes, txid and wtxid
110-
# txid is a hash of all of the legacy transaction fields only
111-
if self.is_segwit:
112-
txid = self.hex[:4] + self.hex[
113-
6:self._offset_before_tx_witnesses] + self.hex[
114-
-4:]
115-
else:
116-
txid = self.hex
117-
self._hash = format_hash(double_sha256(txid))
118-
119-
return self._hash
120-
121105
@property
122106
def hash(self):
123107
"""Returns the transaction's id. Equivalent to the hash for non SegWit transactions,

0 commit comments

Comments
 (0)