def test_spam(self, name, staking_utxo_list, fRandomHeight=False, randomRange=0, randomRange2=0, fDoubleSpend=False, fMustPass=False, fZPoS=False, spending_utxo_list=[]):
    ' General method to create, send and test the spam blocks\n        :param    name:               (string) chain branch (usually either "Main" or "Forked")\n                  staking_utxo_list:  (string list) utxos to use for staking\n                  fRandomHeight:      (bool) send blocks at random height\n                  randomRange:        (int) if fRandomHeight=True, height is >= current-randomRange\n                  randomRange2:       (int) if fRandomHeight=True, height is < current-randomRange2\n                  fDoubleSpend:       (bool) if true, stake input is double spent in block.vtx\n                  fMustPass:          (bool) if true, the blocks must be stored on disk\n                  fZPoS:              (bool) stake the block with zerocoin\n                  spending_utxo_list: (string list) utxos to use for spending\n        :return:  err_msgs:           (string list) reports error messages from the test\n                                      or an empty list if test is successful\n        '
    err_msgs = []
    self.log_data_dir_size()
    block_count = self.node.getblockcount()
    pastBlockHash = self.node.getblockhash(block_count)
    randomCount = block_count
    self.log.info(('Current height: %d' % block_count))
    for i in range(0, self.NUM_BLOCKS):
        if (i != 0):
            self.log.info(('Sent %d blocks out of %d' % (i, self.NUM_BLOCKS)))
        if fRandomHeight:
            randomCount = randint((block_count - randomRange), (block_count - randomRange2))
            pastBlockHash = self.node.getblockhash(randomCount)
        current_block_n = (randomCount + 1)
        stakingPrevOuts = self.get_prevouts(staking_utxo_list, randomCount, zpos=fZPoS)
        spendingPrevOuts = self.get_prevouts(spending_utxo_list, randomCount)
        block = self.create_spam_block(pastBlockHash, stakingPrevOuts, current_block_n, fStakeDoubleSpent=fDoubleSpend, fZPoS=fZPoS, spendingPrevOuts=spendingPrevOuts)
        block_time = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(block.nTime))
        block_size = (len(block.serialize()) / 1000)
        self.log.info('Sending block %d [%s...] - nTime: %s - Size (kb): %.2f', current_block_n, block.hash[:7], block_time, block_size)
        var = self.node.submitblock(bytes_to_hex_str(block.serialize()))
        time.sleep(1)
        if (((not fMustPass) and (var not in [None, 'bad-txns-invalid-ztdps'])) or (fMustPass and (var != 'inconclusive'))):
            self.log.error(('submitblock [fMustPass=%s] result: %s' % (str(fMustPass), str(var))))
            err_msgs.append(('submitblock %d: %s' % (current_block_n, str(var))))
        msg = msg_block(block)
        try:
            self.test_nodes[0].handle_connect()
            self.test_nodes[0].send_message(msg)
            time.sleep(2)
            block_ret = self.node.getblock(block.hash)
            if ((not fMustPass) and (block_ret is not None)):
                self.log.error(('Error, block stored in %s chain' % name))
                err_msgs.append(('getblock %d: result not None' % current_block_n))
            if fMustPass:
                if (block_ret is None):
                    self.log.error(('Error, block NOT stored in %s chain' % name))
                    err_msgs.append(('getblock %d: result is None' % current_block_n))
                else:
                    self.log.info('Good. Block IS stored on disk.')
        except JSONRPCException as e:
            exc_msg = str(e)
            if (exc_msg == "Can't read block from disk (-32603)"):
                if fMustPass:
                    self.log.warning('Bad! Block was NOT stored to disk.')
                    err_msgs.append(exc_msg)
                else:
                    self.log.info('Good. Block was not stored on disk.')
            else:
                self.log.warning(exc_msg)
                err_msgs.append(exc_msg)
        except Exception as e:
            exc_msg = str(e)
            self.log.error(exc_msg)
            err_msgs.append(exc_msg)
    self.log.info(('Sent all %s blocks.' % str(self.NUM_BLOCKS)))
    self.log_data_dir_size()
    return err_msgs
General method to create, send and test the spam blocks
:param    name:               (string) chain branch (usually either "Main" or "Forked")
          staking_utxo_list:  (string list) utxos to use for staking
          fRandomHeight:      (bool) send blocks at random height
          randomRange:        (int) if fRandomHeight=True, height is >= current-randomRange
          randomRange2:       (int) if fRandomHeight=True, height is < current-randomRange2
          fDoubleSpend:       (bool) if true, stake input is double spent in block.vtx
          fMustPass:          (bool) if true, the blocks must be stored on disk
          fZPoS:              (bool) stake the block with zerocoin
          spending_utxo_list: (string list) utxos to use for spending
:return:  err_msgs:           (string list) reports error messages from the test
                              or an empty list if test is successful
def test_spam(self, name, staking_utxo_list, fRandomHeight=False, randomRange=0, randomRange2=0, fDoubleSpend=False, fMustPass=False, fZPoS=False, spending_utxo_list=[]):
    ' General method to create, send and test the spam blocks\n        :param    name:               (string) chain branch (usually either "Main" or "Forked")\n                  staking_utxo_list:  (string list) utxos to use for staking\n                  fRandomHeight:      (bool) send blocks at random height\n                  randomRange:        (int) if fRandomHeight=True, height is >= current-randomRange\n                  randomRange2:       (int) if fRandomHeight=True, height is < current-randomRange2\n                  fDoubleSpend:       (bool) if true, stake input is double spent in block.vtx\n                  fMustPass:          (bool) if true, the blocks must be stored on disk\n                  fZPoS:              (bool) stake the block with zerocoin\n                  spending_utxo_list: (string list) utxos to use for spending\n        :return:  err_msgs:           (string list) reports error messages from the test\n                                      or an empty list if test is successful\n        '
    err_msgs = []
    self.log_data_dir_size()
    block_count = self.node.getblockcount()
    pastBlockHash = self.node.getblockhash(block_count)
    randomCount = block_count
    self.log.info(('Current height: %d' % block_count))
    for i in range(0, self.NUM_BLOCKS):
        if (i != 0):
            self.log.info(('Sent %d blocks out of %d' % (i, self.NUM_BLOCKS)))
        if fRandomHeight:
            randomCount = randint((block_count - randomRange), (block_count - randomRange2))
            pastBlockHash = self.node.getblockhash(randomCount)
        current_block_n = (randomCount + 1)
        stakingPrevOuts = self.get_prevouts(staking_utxo_list, randomCount, zpos=fZPoS)
        spendingPrevOuts = self.get_prevouts(spending_utxo_list, randomCount)
        block = self.create_spam_block(pastBlockHash, stakingPrevOuts, current_block_n, fStakeDoubleSpent=fDoubleSpend, fZPoS=fZPoS, spendingPrevOuts=spendingPrevOuts)
        block_time = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(block.nTime))
        block_size = (len(block.serialize()) / 1000)
        self.log.info('Sending block %d [%s...] - nTime: %s - Size (kb): %.2f', current_block_n, block.hash[:7], block_time, block_size)
        var = self.node.submitblock(bytes_to_hex_str(block.serialize()))
        time.sleep(1)
        if (((not fMustPass) and (var not in [None, 'bad-txns-invalid-ztdps'])) or (fMustPass and (var != 'inconclusive'))):
            self.log.error(('submitblock [fMustPass=%s] result: %s' % (str(fMustPass), str(var))))
            err_msgs.append(('submitblock %d: %s' % (current_block_n, str(var))))
        msg = msg_block(block)
        try:
            self.test_nodes[0].handle_connect()
            self.test_nodes[0].send_message(msg)
            time.sleep(2)
            block_ret = self.node.getblock(block.hash)
            if ((not fMustPass) and (block_ret is not None)):
                self.log.error(('Error, block stored in %s chain' % name))
                err_msgs.append(('getblock %d: result not None' % current_block_n))
            if fMustPass:
                if (block_ret is None):
                    self.log.error(('Error, block NOT stored in %s chain' % name))
                    err_msgs.append(('getblock %d: result is None' % current_block_n))
                else:
                    self.log.info('Good. Block IS stored on disk.')
        except JSONRPCException as e:
            exc_msg = str(e)
            if (exc_msg == "Can't read block from disk (-32603)"):
                if fMustPass:
                    self.log.warning('Bad! Block was NOT stored to disk.')
                    err_msgs.append(exc_msg)
                else:
                    self.log.info('Good. Block was not stored on disk.')
            else:
                self.log.warning(exc_msg)
                err_msgs.append(exc_msg)
        except Exception as e:
            exc_msg = str(e)
            self.log.error(exc_msg)
            err_msgs.append(exc_msg)
    self.log.info(('Sent all %s blocks.' % str(self.NUM_BLOCKS)))
    self.log_data_dir_size()
    return err_msgs