Skip to content

Commit

Permalink
test: fix bugs in test framework
Browse files Browse the repository at this point in the history
  • Loading branch information
LarryRuane committed Dec 22, 2021
1 parent 12e022a commit 8c0177a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 6 additions & 1 deletion qa/rpc-tests/test_framework/mininode.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ def deserialize(self, f):
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""
Expand Down Expand Up @@ -971,6 +971,8 @@ def __init__(self, tx=None):
self.nLockTime = 0
self.nExpiryHeight = 0
self.valueBalance = 0
self.saplingBundle = SaplingBundle()
self.orchardBundle = OrchardBundle()
self.shieldedSpends = []
self.shieldedOutputs = []
self.vJoinSplit = []
Expand All @@ -988,6 +990,8 @@ def __init__(self, tx=None):
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)
Expand Down Expand Up @@ -1075,6 +1079,7 @@ def serialize(self):

# 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)
Expand Down
6 changes: 3 additions & 3 deletions qa/rpc-tests/test_framework/zip244.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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
Expand All @@ -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()
Expand Down

0 comments on commit 8c0177a

Please sign in to comment.