本文整理匯總了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)