Browse Source

add test for sapling spend with transparent recipient

pull/4/head
arielgabizon 6 years ago
parent
commit
eb0bf23751
  1. 21
      qa/rpc-tests/finalsaplingroot.py

21
qa/rpc-tests/finalsaplingroot.py

@ -108,7 +108,7 @@ class FinalSaplingRootTest(BitcoinTestFramework):
assert_equal(self.nodes[1].z_getbalance(zaddr1), Decimal("10"))
assert_equal(root, self.nodes[0].getblock("204")["finalsaplingroot"])
# Mine a block with a Sapling shielded tx and verify the final Sapling root changes
# Mine a block with a Sapling shielded recipient and verify the final Sapling root changes
saplingAddr1 = self.nodes[1].z_getnewaddress("sapling")
recipients = []
recipients.append({"address": saplingAddr1, "amount": Decimal('12.34')})
@ -127,5 +127,24 @@ class FinalSaplingRootTest(BitcoinTestFramework):
result = self.nodes[0].getrawtransaction(mytxid, 1)
assert_equal(len(result["vShieldedOutput"]), 2) # there is Sapling shielded change
# Mine a block with a Sapling shielded sender and transparent recipient and verify the final Sapling root doesn't change
taddr2 = self.nodes[0].getnewaddress()
recipients = []
recipients.append({"address": taddr2, "amount": Decimal('12.34')})
myopid = self.nodes[1].z_sendmany(saplingAddr1, recipients, 1, 0)
mytxid = wait_and_assert_operationid_status(self.nodes[1], myopid)
self.sync_all()
self.nodes[0].generate(1)
self.sync_all()
assert_equal(len(self.nodes[0].getblock("206")["tx"]), 2)
assert_equal(self.nodes[0].z_getbalance(taddr2), Decimal("12.34"))
blk = self.nodes[0].getblock("206")
root = blk["finalsaplingroot"]
assert_equal(root, self.nodes[0].getblock("205")["finalsaplingroot"])
if __name__ == '__main__':
FinalSaplingRootTest().main()

Loading…
Cancel
Save