本文整理汇总了Python中coinpy.model.protocol.structures.uint256.Uint256.from_bytestr_be方法的典型用法代码示例。如果您正苦于以下问题:Python Uint256.from_bytestr_be方法的具体用法?Python Uint256.from_bytestr_be怎么用?Python Uint256.from_bytestr_be使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类coinpy.model.protocol.structures.uint256.Uint256
的用法示例。
在下文中一共展示了Uint256.from_bytestr_be方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: deserialize
# 需要导入模块: from coinpy.model.protocol.structures.uint256 import Uint256 [as 别名]
# 或者: from coinpy.model.protocol.structures.uint256.Uint256 import from_bytestr_be [as 别名]
def deserialize(data):
length = struct.calcsize(">I32sBBI")
if len(data) < length:
raise Exception("size too small")
index_data, outpoint_data = data[:length], data[length:]
id, hash, index, type_value, masterkey_id = struct.unpack(">I32sBBI", index_data)
if type_value not in OutpointIndexSerializer.OUTPOINT_TYPES:
raise Exception("unknown outpoint type: %d" % (type_value))
oupoint_type = OutpointIndexSerializer.OUTPOINT_TYPES[type_value]
if (oupoint_type == OutpointIndex.PUBKEY or
oupoint_type == OutpointIndex.PUBKEY_HASH):
outpoint = PubKeyOutpointSerializer.deserialize(outpoint_data, oupoint_type == OutpointIndex.PUBKEY_HASH)
elif oupoint_type == OutpointIndex.MULTISIG:
outpoint = MultiSigOutpointSerializer.serialize(outpoint_data)
elif oupoint_type == OutpointIndex.SCRIPT_HASH:
outpoint = ScriptHashOutpointSerializer.serialize(outpoint_data)
return OutpointIndex(id, Uint256.from_bytestr_be(hash), index, oupoint_type, masterkey_id, outpoint)