Update tests for async z_sendmany

Need to check the opid status now instead of catching an exception.
This commit is contained in:
Greg Pfeil 2022-11-11 09:47:35 -07:00 committed by Greg Pfeil
parent 010141426d
commit c1dbe12d77
No known key found for this signature in database
GPG Key ID: 1193ACD196ED61F2
2 changed files with 11 additions and 17 deletions

View File

@ -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

View File

@ -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()