当前位置: 首页>>代码示例>>Python>>正文


Python BinaryUnpacker.get方法代码示例

本文整理汇总了Python中armoryengine.BinaryUnpacker.BinaryUnpacker.get方法的典型用法代码示例。如果您正苦于以下问题:Python BinaryUnpacker.get方法的具体用法?Python BinaryUnpacker.get怎么用?Python BinaryUnpacker.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在armoryengine.BinaryUnpacker.BinaryUnpacker的用法示例。


在下文中一共展示了BinaryUnpacker.get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: unserialize

# 需要导入模块: from armoryengine.BinaryUnpacker import BinaryUnpacker [as 别名]
# 或者: from armoryengine.BinaryUnpacker.BinaryUnpacker import get [as 别名]
 def unserialize(self, toUnpack):
    bu = BinaryUnpacker(toUnpack)
    self.messageType = bu.get(VAR_STR)
    self.rejectCode = bu.get(INT8)
    self.message = bu.get(VAR_STR)
    self.data = bu.get(BINARY_CHUNK, bu.getRemainingSize())
    self.serializedData = toUnpack
    return self
开发者ID:CarltonCode,项目名称:BitcoinArmory,代码行数:10,代码来源:Networking.py

示例2: unserialize

# 需要导入模块: from armoryengine.BinaryUnpacker import BinaryUnpacker [as 别名]
# 或者: from armoryengine.BinaryUnpacker.BinaryUnpacker import get [as 别名]
   def unserialize(self, toUnpack):
      if isinstance(toUnpack, BinaryUnpacker):
         blkData = toUnpack
      else:
         blkData = BinaryUnpacker( toUnpack )

      self.version     = blkData.get(UINT32)
      self.prevBlkHash = blkData.get(BINARY_CHUNK, 32)
      self.merkleRoot  = blkData.get(BINARY_CHUNK, 32)
      self.timestamp   = blkData.get(UINT32)
      self.diffBits    = blkData.get(BINARY_CHUNK, 4)
      self.nonce       = blkData.get(UINT32)
      self.theHash     = hash256(self.serialize())
      return self
开发者ID:Rudd-O,项目名称:BitcoinArmory,代码行数:16,代码来源:Block.py

示例3: unserialize

# 需要导入模块: from armoryengine.BinaryUnpacker import BinaryUnpacker [as 别名]
# 或者: from armoryengine.BinaryUnpacker.BinaryUnpacker import get [as 别名]
   def unserialize(self, toUnpack):
      if isinstance(toUnpack, BinaryUnpacker):
         msgData = toUnpack
      else:
         msgData = BinaryUnpacker( toUnpack )


      self.magic = msgData.get(BINARY_CHUNK, 4)
      self.cmd   = msgData.get(BINARY_CHUNK, 12).strip('\x00')
      length     = msgData.get(UINT32)
      chksum     = msgData.get(BINARY_CHUNK, 4)
      payload    = msgData.get(BINARY_CHUNK, length)
      payload    = verifyChecksum(payload, chksum)

      self.payload = PayloadMap[self.cmd]().unserialize(payload)

      if self.magic != MAGIC_BYTES:
         raise NetworkIDError, 'Message has wrong network bytes!'
      return self
开发者ID:FuzzyBearBTC,项目名称:PeercoinArmory,代码行数:21,代码来源:Networking.py

示例4: executeScript

# 需要导入模块: from armoryengine.BinaryUnpacker import BinaryUnpacker [as 别名]
# 或者: from armoryengine.BinaryUnpacker.BinaryUnpacker import get [as 别名]
   def executeScript(self, binaryScript, stack=[]):
      self.stack = stack
      self.stackAlt  = []
      scriptData = BinaryUnpacker(binaryScript)
      self.lastOpCodeSepPos = None

      while scriptData.getRemainingSize() > 0:
         opcode = scriptData.get(UINT8)
         exitCode = self.executeOpCode(opcode, scriptData, self.stack, self.stackAlt)
         if not exitCode == SCRIPT_NO_ERROR:
            if exitCode==OP_NOT_IMPLEMENTED:
               LOGERROR('***ERROR: OpCodes OP_IF, OP_NOTIF, OP_ELSE, OP_ENDIF,')
               LOGERROR('          have not been implemented, yet.  This script')
               LOGERROR('          could not be evaluated.')
            if exitCode==OP_DISABLED:
               LOGERROR('***ERROR: This script included an op code that has been')
               LOGERROR('          disabled for security reasons.  Script eval')
               LOGERROR('          failed.')
            return exitCode

      return SCRIPT_NO_ERROR
开发者ID:Bitcoinsulting,项目名称:BitcoinArmorydev,代码行数:23,代码来源:Script.py


注:本文中的armoryengine.BinaryUnpacker.BinaryUnpacker.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。