test: fix bugs in test framework
This commit is contained in:
parent
12e022a53a
commit
8c0177a507
|
@ -660,7 +660,7 @@ class OutputDescription(object):
|
|||
self.encCiphertext = f.read(580)
|
||||
self.outCiphertext = f.read(80)
|
||||
self.zkproof = Groth16Proof()
|
||||
self.zkproof.deserialize()
|
||||
self.zkproof.deserialize(f)
|
||||
|
||||
def serialize(self):
|
||||
r = b""
|
||||
|
@ -971,6 +971,8 @@ class CTransaction(object):
|
|||
self.nLockTime = 0
|
||||
self.nExpiryHeight = 0
|
||||
self.valueBalance = 0
|
||||
self.saplingBundle = SaplingBundle()
|
||||
self.orchardBundle = OrchardBundle()
|
||||
self.shieldedSpends = []
|
||||
self.shieldedOutputs = []
|
||||
self.vJoinSplit = []
|
||||
|
@ -988,6 +990,8 @@ class CTransaction(object):
|
|||
self.nLockTime = tx.nLockTime
|
||||
self.nExpiryHeight = tx.nExpiryHeight
|
||||
self.valueBalance = tx.valueBalance
|
||||
self.saplingBundle = copy.deepcopy(tx.saplingBundle)
|
||||
self.orchardBundle = copy.deepcopy(tx.orchardBundle)
|
||||
self.shieldedSpends = copy.deepcopy(tx.shieldedSpends)
|
||||
self.shieldedOutputs = copy.deepcopy(tx.shieldedOutputs)
|
||||
self.vJoinSplit = copy.deepcopy(tx.vJoinSplit)
|
||||
|
@ -1075,6 +1079,7 @@ class CTransaction(object):
|
|||
|
||||
# Common transaction fields
|
||||
r += struct.pack("<I", header)
|
||||
r += struct.pack("<I", self.nVersionGroupId)
|
||||
r += struct.pack("<I", self.nConsensusBranchId)
|
||||
r += struct.pack("<I", self.nLockTime)
|
||||
r += struct.pack("<I", self.nExpiryHeight)
|
||||
|
|
|
@ -52,7 +52,7 @@ def sapling_digest(saplingBundle):
|
|||
if len(saplingBundle.spends) + len(saplingBundle.outputs) > 0:
|
||||
digest.update(sapling_spends_digest(saplingBundle))
|
||||
digest.update(sapling_outputs_digest(saplingBundle))
|
||||
digest.update(struct.pack('<Q', saplingBundle.valueBalance))
|
||||
digest.update(struct.pack('<q', saplingBundle.valueBalance))
|
||||
|
||||
return digest.digest()
|
||||
|
||||
|
@ -126,7 +126,7 @@ def sapling_outputs_noncompact_digest(saplingBundle):
|
|||
for desc in saplingBundle.outputs:
|
||||
digest.update(ser_uint256(desc.cv))
|
||||
digest.update(desc.encCiphertext[564:])
|
||||
digest.update(desc.outCipherText)
|
||||
digest.update(desc.outCiphertext)
|
||||
return digest.digest()
|
||||
|
||||
# Orchard
|
||||
|
@ -139,7 +139,7 @@ def orchard_digest(orchardBundle):
|
|||
digest.update(orchard_actions_memos_digest(orchardBundle))
|
||||
digest.update(orchard_actions_noncompact_digest(orchardBundle))
|
||||
digest.update(struct.pack('<B', orchardBundle.flags()))
|
||||
digest.update(struct.pack('<Q', orchardBundle.valueBalance))
|
||||
digest.update(struct.pack('<q', orchardBundle.valueBalance))
|
||||
digest.update(bytes(orchardBundle.anchor))
|
||||
|
||||
return digest.digest()
|
||||
|
|
Loading…
Reference in New Issue