@@ -756,7 +756,7 @@ def launchUnstarted(self, numToLaunch=1):
756756
757757 # Spread funds across accounts with transactions spread through cluster nodes.
758758 # Validate transactions are synchronized on root node
759- def spreadFunds (self , source , accounts , amount = 1 ):
759+ def spreadFunds (self , source , accounts , amount = 1 , waitForFinalization = False ):
760760 assert (source )
761761 assert (isinstance (source , Account ))
762762 assert (accounts )
@@ -819,9 +819,14 @@ def spreadFunds(self, source, accounts, amount=1):
819819 # As an extra step wait for last transaction on the root node
820820 node = self .nodes [0 ]
821821 if Utils .Debug : Utils .Print ("Wait for transaction id %s on node port %d" % (transId , node .port ))
822- if node .waitForTransactionInBlock (transId ) is False :
823- Utils .Print ("ERROR: Failed to validate transaction %s got rolled into a block on server port %d." % (transId , node .port ))
824- return False
822+ if waitForFinalization :
823+ if node .waitForTransFinalization (transId ) is False :
824+ Utils .Print ("ERROR: Failed to validate transaction %s got rolled into a final block on server port %d." % (transId , node .port ))
825+ return False
826+ else :
827+ if node .waitForTransactionInBlock (transId ) is False :
828+ Utils .Print ("ERROR: Failed to validate transaction %s got rolled into a block on server port %d." % (transId , node .port ))
829+ return False
825830
826831 return True
827832
@@ -850,7 +855,7 @@ def validateSpreadFunds(self, initialBalances, transferAmount, source, accounts)
850855
851856 return True
852857
853- def spreadFundsAndValidate (self , transferAmount = 1 ):
858+ def spreadFundsAndValidate (self , transferAmount = 1 , waitForFinalization = False ):
854859 """Sprays 'transferAmount' funds across configured accounts and validates action. The spray is done in a trickle down fashion with account 1
855860 receiving transferAmount*n SYS and forwarding x-transferAmount funds. Transfer actions are spread round-robin across the cluster to vaidate system cohesiveness."""
856861
@@ -859,7 +864,7 @@ def spreadFundsAndValidate(self, transferAmount=1):
859864 assert (initialBalances )
860865 assert (isinstance (initialBalances , dict ))
861866
862- if False == self .spreadFunds (self .defproduceraAccount , self .accounts , transferAmount ):
867+ if False == self .spreadFunds (self .defproduceraAccount , self .accounts , transferAmount , waitForFinalization = waitForFinalization ):
863868 Utils .Print ("ERROR: Failed to spread funds across nodes." )
864869 return False
865870
0 commit comments