Apply suggestions from code review

Co-authored-by: str4d <thestr4d@gmail.com>
This commit is contained in:
Kris Nuttycombe 2022-03-30 10:08:00 -06:00 committed by Kris Nuttycombe
parent bc33ba5a9f
commit 53cc7ecceb
1 changed files with 7 additions and 8 deletions

View File

@ -7,7 +7,6 @@ from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import ( from test_framework.util import (
NU5_BRANCH_ID, NU5_BRANCH_ID,
assert_equal, assert_equal,
connect_nodes_bi,
get_coinbase_address, get_coinbase_address,
nuparams, nuparams,
start_nodes, start_nodes,
@ -19,7 +18,7 @@ from test_framework.util import (
from decimal import Decimal from decimal import Decimal
# Test wallet behaviour with the Orchard protocol # Test wallet behaviour with the Orchard protocol
class WalletOrchardTest(BitcoinTestFramework): class WalletOrchardPersistenceTest(BitcoinTestFramework):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
self.num_nodes = 4 self.num_nodes = 4
@ -33,7 +32,7 @@ class WalletOrchardTest(BitcoinTestFramework):
# Sanity-check the test harness # Sanity-check the test harness
assert_equal(self.nodes[0].getblockcount(), 200) assert_equal(self.nodes[0].getblockcount(), 200)
# Send some sapling funds to node 2 for later spending after we split the network # Send some Orchard funds to node 2 for later spending after we split the network
acct0 = self.nodes[0].z_getnewaccount()['account'] acct0 = self.nodes[0].z_getnewaccount()['account']
ua0 = self.nodes[0].z_getaddressforaccount(acct0, ['sapling', 'orchard'])['address'] ua0 = self.nodes[0].z_getaddressforaccount(acct0, ['sapling', 'orchard'])['address']
@ -43,7 +42,7 @@ class WalletOrchardTest(BitcoinTestFramework):
# Mine the tx & activate NU5 # Mine the tx & activate NU5
self.sync_all() self.sync_all()
self.nodes[0].generate(5) self.nodes[0].generate(1)
self.sync_all() self.sync_all()
assert_equal( assert_equal(
@ -56,7 +55,7 @@ class WalletOrchardTest(BitcoinTestFramework):
recipients = [{"address": ua1, "amount": 1}] recipients = [{"address": ua1, "amount": 1}]
myopid = self.nodes[0].z_sendmany(ua0, recipients, 1, 0) myopid = self.nodes[0].z_sendmany(ua0, recipients, 1, 0)
source_tx = wait_and_assert_operationid_status(self.nodes[0], myopid) wait_and_assert_operationid_status(self.nodes[0], myopid)
self.sync_all() self.sync_all()
self.nodes[0].generate(1) self.nodes[0].generate(1)
@ -73,7 +72,7 @@ class WalletOrchardTest(BitcoinTestFramework):
# note commitment tree gets advanced. # note commitment tree gets advanced.
recipients = [{"address": ua0, "amount": 1}] recipients = [{"address": ua0, "amount": 1}]
myopid = self.nodes[0].z_sendmany(ua0, recipients, 1, 0) myopid = self.nodes[0].z_sendmany(ua0, recipients, 1, 0)
source_tx = wait_and_assert_operationid_status(self.nodes[0], myopid) wait_and_assert_operationid_status(self.nodes[0], myopid)
self.sync_all() self.sync_all()
self.nodes[0].generate(1) self.nodes[0].generate(1)
@ -90,7 +89,7 @@ class WalletOrchardTest(BitcoinTestFramework):
recipients = [{"address": ua0, "amount": Decimal('0.5')}] recipients = [{"address": ua0, "amount": Decimal('0.5')}]
myopid = self.nodes[1].z_sendmany(ua1, recipients, 1, 0) myopid = self.nodes[1].z_sendmany(ua1, recipients, 1, 0)
txid = wait_and_assert_operationid_status(self.nodes[1], myopid) wait_and_assert_operationid_status(self.nodes[1], myopid)
self.sync_all() self.sync_all()
self.nodes[0].generate(1) self.nodes[0].generate(1)
@ -101,4 +100,4 @@ class WalletOrchardTest(BitcoinTestFramework):
self.nodes[0].z_getbalanceforaccount(acct0)) self.nodes[0].z_getbalanceforaccount(acct0))
if __name__ == '__main__': if __name__ == '__main__':
WalletOrchardTest().main() WalletOrchardPersistenceTest().main()