Rename header() to version_bytes()
Now that the v5 transaction format has an actual header region, this old naming makes less sense.
This commit is contained in:
parent
bc75d044a1
commit
445c2602f4
|
@ -311,12 +311,12 @@ class LegacyTransaction(object):
|
|||
if self.nVersion >= SAPLING_TX_VERSION:
|
||||
self.bindingSig = rand.b(64) # Invalid
|
||||
|
||||
def header(self):
|
||||
def version_bytes(self):
|
||||
return self.nVersion | (1 << 31 if self.fOverwintered else 0)
|
||||
|
||||
def __bytes__(self):
|
||||
ret = b''
|
||||
ret += struct.pack('<I', self.header())
|
||||
ret += struct.pack('<I', self.version_bytes())
|
||||
if self.fOverwintered:
|
||||
ret += struct.pack('<I', self.nVersionGroupId)
|
||||
|
||||
|
@ -421,7 +421,7 @@ class TransactionV5(object):
|
|||
# v^balanceOrchard is defined to be 0.
|
||||
self.valueBalanceOrchard = 0
|
||||
|
||||
def header(self):
|
||||
def version_bytes(self):
|
||||
return NU5_TX_VERSION | (1 << 31)
|
||||
|
||||
# TODO: Update ZIP 225 to document endianness
|
||||
|
@ -429,7 +429,7 @@ class TransactionV5(object):
|
|||
ret = b''
|
||||
|
||||
# Common Transaction Fields
|
||||
ret += struct.pack('<I', self.header())
|
||||
ret += struct.pack('<I', self.version_bytes())
|
||||
ret += struct.pack('<I', self.nVersionGroupId)
|
||||
ret += struct.pack('<I', self.nConsensusBranchId)
|
||||
ret += struct.pack('<I', self.nLockTime)
|
||||
|
|
|
@ -76,7 +76,7 @@ def signature_hash(scriptCode, tx, nIn, nHashType, amount, consensusBranchId):
|
|||
person=b'ZcashSigHash' + struct.pack('<I', consensusBranchId),
|
||||
)
|
||||
|
||||
digest.update(struct.pack('<I', tx.header()))
|
||||
digest.update(struct.pack('<I', tx.version_bytes()))
|
||||
digest.update(struct.pack('<I', tx.nVersionGroupId))
|
||||
digest.update(hashPrevouts)
|
||||
digest.update(hashSequence)
|
||||
|
|
|
@ -80,7 +80,7 @@ def signature_hash(scriptCode, tx, nIn, nHashType, amount, consensusBranchId):
|
|||
person=b'ZcashSigHash' + struct.pack('<I', consensusBranchId),
|
||||
)
|
||||
|
||||
digest.update(struct.pack('<I', tx.header()))
|
||||
digest.update(struct.pack('<I', tx.version_bytes()))
|
||||
digest.update(struct.pack('<I', tx.nVersionGroupId))
|
||||
digest.update(hashPrevouts)
|
||||
digest.update(hashSequence)
|
||||
|
|
|
@ -150,7 +150,7 @@ def orchard_actions_noncompact_digest(tx):
|
|||
def header_digest(tx):
|
||||
digest = blake2b(digest_size=32, person=b'ZTxIdHeadersHash')
|
||||
|
||||
digest.update(struct.pack('<I', tx.header()))
|
||||
digest.update(struct.pack('<I', tx.version_bytes()))
|
||||
digest.update(struct.pack('<I', tx.nVersionGroupId))
|
||||
digest.update(struct.pack('<I', tx.nConsensusBranchId))
|
||||
digest.update(struct.pack('<I', tx.nLockTime))
|
||||
|
|
Loading…
Reference in New Issue