def generate_test_data(self, filename):
    mocktime = 1525107225
    self.nodes[0].setmocktime(mocktime)
    self.nodes[0].createwallet(wallet_name='testwallet')
    self.nodes[0].generatetoaddress((COINBASE_MATURITY + 1), self.nodes[0].getnewaddress())
    address = self.nodes[0].get_deterministic_priv_key().address
    self.nodes[0].sendtoaddress(address=address, amount=10, subtractfeefromamount=True)
    self.generate(self.nodes[0], 1)
    self.nodes[0].sendtoaddress(address=address, amount=10, subtractfeefromamount=True)
    self.nodes[0].sendtoaddress(address=address, amount=10, subtractfeefromamount=False)
    self.nodes[0].settxfee(amount=0.003)
    self.nodes[0].sendtoaddress(address=address, amount=1, subtractfeefromamount=True)
    self.sync_all()
    self.generate(self.nodes[0], 1)
    self.expected_stats = self.get_stats()
    blocks = []
    tip = self.nodes[0].getbestblockhash()
    blockhash = None
    height = 0
    while (tip != blockhash):
        blockhash = self.nodes[0].getblockhash(height)
        blocks.append(self.nodes[0].getblock(blockhash, 0))
        height += 1
    to_dump = {'blocks': blocks, 'mocktime': int(mocktime), 'stats': self.expected_stats}
    with open(filename, 'w', encoding='utf8') as f:
        json.dump(to_dump, f, sort_keys=True, indent=2)
def generate_test_data(self, filename):
    mocktime = 1525107225
    self.nodes[0].setmocktime(mocktime)
    self.nodes[0].createwallet(wallet_name='testwallet')
    self.nodes[0].generatetoaddress((COINBASE_MATURITY + 1), self.nodes[0].getnewaddress())
    address = self.nodes[0].get_deterministic_priv_key().address
    self.nodes[0].sendtoaddress(address=address, amount=10, subtractfeefromamount=True)
    self.generate(self.nodes[0], 1)
    self.nodes[0].sendtoaddress(address=address, amount=10, subtractfeefromamount=True)
    self.nodes[0].sendtoaddress(address=address, amount=10, subtractfeefromamount=False)
    self.nodes[0].settxfee(amount=0.003)
    self.nodes[0].sendtoaddress(address=address, amount=1, subtractfeefromamount=True)
    self.sync_all()
    self.generate(self.nodes[0], 1)
    self.expected_stats = self.get_stats()
    blocks = []
    tip = self.nodes[0].getbestblockhash()
    blockhash = None
    height = 0
    while (tip != blockhash):
        blockhash = self.nodes[0].getblockhash(height)
        blocks.append(self.nodes[0].getblock(blockhash, 0))
        height += 1
    to_dump = {'blocks': blocks, 'mocktime': int(mocktime), 'stats': self.expected_stats}
    with open(filename, 'w', encoding='utf8') as f:
        json.dump(to_dump, f, sort_keys=True, indent=2)