MCPcopy
hub / github.com/petertodd/python-bitcoinlib / GetTxid

Method GetTxid

bitcoin/core/__init__.py:436–447  ·  view source on GitHub ↗

Get the transaction ID. This differs from the transactions hash as given by GetHash. GetTxid excludes witness data, while GetHash includes it.

(self)

Source from the content-addressed store, hash-verified

434 return cls(tx.vin, tx.vout, tx.nLockTime, tx.nVersion, tx.wit)
435
436 def GetTxid(self):
437 """Get the transaction ID.
438
439 This differs from the transactions hash as given by GetHash. GetTxid
440 excludes witness data, while GetHash includes it.
441 """
442 if self.wit != CTxWitness():
443 txid = Hash(CTransaction(self.vin, self.vout, self.nLockTime,
444 self.nVersion).serialize())
445 else:
446 txid = Hash(self.serialize())
447 return txid
448
449 def calc_weight(self):
450 """Calculate the transaction weight, as defined by BIP141.

Callers 4

create_test_txsMethod · 0.95
VerifySignatureFunction · 0.80
CheckBlockFunction · 0.80

Calls 4

CTxWitnessClass · 0.85
HashFunction · 0.85
CTransactionClass · 0.85
serializeMethod · 0.45

Tested by 1

create_test_txsMethod · 0.76