def run_test(self):
    chain_height = self.nodes[0].getblockcount()
    assert_equal(chain_height, 200)
    node0_address = self.nodes[0].getnewaddress()
    b = [self.nodes[0].getblockhash(n) for n in range(101, 103)]
    coinbase_txids = [self.nodes[0].getblock(h)['tx'][0] for h in b]
    spends_raw = [create_raw_transaction(self.nodes[0], txid, node0_address, amount=49.99) for txid in coinbase_txids]
    spend_101_id = self.nodes[0].sendrawtransaction(spends_raw[0])
    assert_raises_rpc_error((- 26), 'bad-txns-premature-spend-of-coinbase', self.nodes[0].sendrawtransaction, spends_raw[1])
    assert_equal(self.nodes[0].getrawmempool(), [spend_101_id])
    self.nodes[0].generate(1)
    assert_equal(set(self.nodes[0].getrawmempool()), set())
    spend_102_id = self.nodes[0].sendrawtransaction(spends_raw[1])
    assert_equal(self.nodes[0].getrawmempool(), [spend_102_id])
def run_test(self):
    chain_height = self.nodes[0].getblockcount()
    assert_equal(chain_height, 200)
    node0_address = self.nodes[0].getnewaddress()
    b = [self.nodes[0].getblockhash(n) for n in range(101, 103)]
    coinbase_txids = [self.nodes[0].getblock(h)['tx'][0] for h in b]
    spends_raw = [create_raw_transaction(self.nodes[0], txid, node0_address, amount=49.99) for txid in coinbase_txids]
    spend_101_id = self.nodes[0].sendrawtransaction(spends_raw[0])
    assert_raises_rpc_error((- 26), 'bad-txns-premature-spend-of-coinbase', self.nodes[0].sendrawtransaction, spends_raw[1])
    assert_equal(self.nodes[0].getrawmempool(), [spend_101_id])
    self.nodes[0].generate(1)
    assert_equal(set(self.nodes[0].getrawmempool()), set())
    spend_102_id = self.nodes[0].sendrawtransaction(spends_raw[1])
    assert_equal(self.nodes[0].getrawmempool(), [spend_102_id])