def is_raw_block(x): try: b = Block.deserialize(x.decode('hex')) return True except Exception: return False
def is_raw_tx(x): try: t = Transaction.deserialize(x.decode('hex')) return True except Exception: return False