From c1dbe12d77e6d14dd8fdb6e3982fd49497b5df8f Mon Sep 17 00:00:00 2001 From: Greg Pfeil Date: Fri, 11 Nov 2022 09:47:35 -0700 Subject: [PATCH] Update tests for async z_sendmany Need to check the opid status now instead of catching an exception. --- qa/rpc-tests/remove_sprout_shielding.py | 10 ++++------ qa/rpc-tests/wallet_sapling.py | 18 +++++++----------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/qa/rpc-tests/remove_sprout_shielding.py b/qa/rpc-tests/remove_sprout_shielding.py index a54a0b9dd..e14587f20 100755 --- a/qa/rpc-tests/remove_sprout_shielding.py +++ b/qa/rpc-tests/remove_sprout_shielding.py @@ -21,7 +21,7 @@ from test_framework.util import ( import logging HAS_CANOPY = [ - '-nurejectoldversions=false', + '-nurejectoldversions=false', '-anchorconfirmations=1', nuparams(BLOSSOM_BRANCH_ID, 205), nuparams(HEARTWOOD_BRANCH_ID, 210), @@ -88,11 +88,9 @@ class RemoveSproutShieldingTest (BitcoinTestFramework): # Create taddr -> Sprout z_sendmany transaction on node 0. Should fail sprout_addr = self.nodes[1].z_getnewaddress('sprout') - assert_raises_message( - JSONRPCException, - "Sending funds into the Sprout value pool is not supported by z_sendmany", - self.nodes[0].z_sendmany, - taddr_0, [{"address": sprout_addr, "amount": 1}]) + recipients = [{"address": sprout_addr, "amount": Decimal('1')}] + myopid = self.nodes[0].z_sendmany(taddr_0, recipients, 1, 0, 'AllowRevealedSenders') + wait_and_assert_operationid_status(self.nodes[0], myopid, "failed", "Sending funds into the Sprout pool is no longer supported.") print("taddr -> Sprout z_sendmany tx rejected at Canopy activation on node 0") # Create z_mergetoaddress [taddr, Sprout] -> Sprout transaction on node 0. Should fail diff --git a/qa/rpc-tests/wallet_sapling.py b/qa/rpc-tests/wallet_sapling.py index dd605d0dc..aa772d793 100755 --- a/qa/rpc-tests/wallet_sapling.py +++ b/qa/rpc-tests/wallet_sapling.py @@ -4,7 +4,6 @@ # file COPYING or https://www.opensource.org/licenses/mit-license.php . from test_framework.test_framework import BitcoinTestFramework -from test_framework.authproxy import JSONRPCException from test_framework.util import ( assert_equal, get_coinbase_address, @@ -170,16 +169,13 @@ class WalletSaplingTest(BitcoinTestFramework): # Make sure we get a useful error when trying to send to both sprout and sapling node4_sproutaddr = self.nodes[3].z_getnewaddress('sprout') node4_saplingaddr = self.nodes[3].z_getnewaddress('sapling') - try: - self.nodes[1].z_sendmany( - taddr1, - [{'address': node4_sproutaddr, 'amount': Decimal('2.5')}, - {'address': node4_saplingaddr, 'amount': Decimal('2.5') - DEFAULT_FEE}], - 1, DEFAULT_FEE, 'AllowRevealedSenders' - ) - raise AssertionError("Should have thrown an exception") - except JSONRPCException as e: - assert_equal("Sending funds into the Sprout value pool is not supported by z_sendmany", e.error['message']) + myopid = self.nodes[1].z_sendmany( + taddr1, + [{'address': node4_sproutaddr, 'amount': Decimal('2.5')}, + {'address': node4_saplingaddr, 'amount': Decimal('2.5') - DEFAULT_FEE}], + 1, DEFAULT_FEE, 'AllowRevealedSenders' + ) + wait_and_assert_operationid_status(self.nodes[1], myopid, "failed", "Sending funds into the Sprout pool is no longer supported.") if __name__ == '__main__': WalletSaplingTest().main()