def test_blockheight_extensively(self):
        blockhashes = ["blockhash{}".format(x) for x in range(0, 10)]

        blocks = []
        for blockhash in blockhashes:
            blocks.append({"hash": blockhash})

        proxy = FakeBitcoinProxy(blocks=blocks)

        for (expected_height, blockhash) in enumerate(blockhashes):
            blockdata = proxy.getblock(blockhash)
            self.assertEqual(blockdata["height"], expected_height)
    def test_getblock_with_bytes(self):
        blockhash0 = "00008c0c84aee66413f1e8ff95fdca5e8ebf35c94b090290077cdcea64936301"

        blocks = [
            {
                "hash": blockhash0
            },
        ]

        proxy = FakeBitcoinProxy(blocks=blocks)
        result = proxy.getblock(lx(blockhash0))

        self.assertEqual(type(result), dict)
    def test_getblock_returns_transaction_data(self):
        blockhash0 = "00008c0c84aee66413f1e8ff95fdca5e8ebf35c94b090290077cdcea64936302"

        transaction_txids = ["foo", "bar"]

        blocks = [
            {
                "hash": blockhash0,
                "tx": transaction_txids
            },
        ]

        proxy = FakeBitcoinProxy(blocks=blocks)
        result = proxy.getblock(blockhash0)

        self.assertTrue("tx" in result.keys())
        self.assertEqual(type(result["tx"]), list)
        self.assertEqual(result["tx"], transaction_txids)
    def test_getblock_with_string(self):
        blockhash0 = "blockhash0"
        blockhash1 = "blockhash1"

        blocks = [
            {
                "hash": blockhash0
            },
            {
                "hash": blockhash1
            },
        ]

        proxy = FakeBitcoinProxy(blocks=blocks)
        result = proxy.getblock(blockhash0)

        self.assertEqual(type(result), dict)

        # should have a height now
        self.assertTrue("height" in result.keys())
        self.assertEqual(result["height"], 0)