:param blockhash: hash of the block to retrieve data for :raise IndexError: invalid blockhash
(self, blockhash, *args, **kwargs)
| 168 | block["height"] = height |
| 169 | |
| 170 | def getblock(self, blockhash, *args, **kwargs): |
| 171 | """ |
| 172 | :param blockhash: hash of the block to retrieve data for |
| 173 | :raise IndexError: invalid blockhash |
| 174 | """ |
| 175 | |
| 176 | # Note that the actual "getblock" bitcoind RPC call from |
| 177 | # python-bitcoinlib returns a CBlock object, not a dictionary. |
| 178 | |
| 179 | if isinstance(blockhash, bytes): |
| 180 | blockhash = b2lx(blockhash) |
| 181 | |
| 182 | for block in self.blocks: |
| 183 | if block["hash"] == blockhash: |
| 184 | return block |
| 185 | |
| 186 | raise IndexError("no block found for blockhash {}".format(blockhash)) |
| 187 | |
| 188 | def getblockhash(self, blockheight): |
| 189 | """ |