예제 #1
0
   def getAllHeadersAtHeight(self, height):

      key = '\x02'
      keybody = struct.pack('>I', height)
      key = key +keybody
      
      try:
         headers = ArmoryDB.dbheaders.Get(key)
      except:
         return None
      nheaders = struct.unpack_from('B', headers)

      tlength = 1 +33*nheaders[0]
      pos=1
      BlockHeaderList = []
      while(pos<tlength):
         blkkey = '\x01' + headers[pos+1:pos+33]
         val = ArmoryDB.dbheaders.Get(blkkey)
         rtBlock = PyBlockHeader()
         rtBlock.unserialize(val)
         BlockHeaderList.append(rtBlock)
         
         pos = pos+33;

      return BlockHeaderList
예제 #2
0
    def getAllHeadersAtHeight(self, height):

        key = '\x02'
        keybody = struct.pack('>I', height)
        key = key + keybody

        try:
            headers = ArmoryDB.dbheaders.Get(key)
        except:
            return None
        nheaders = struct.unpack_from('B', headers)

        tlength = 1 + 33 * nheaders[0]
        pos = 1
        BlockHeaderList = []
        while (pos < tlength):
            blkkey = '\x01' + headers[pos + 1:pos + 33]
            val = ArmoryDB.dbheaders.Get(blkkey)
            rtBlock = PyBlockHeader()
            rtBlock.unserialize(val)
            BlockHeaderList.append(rtBlock)

            pos = pos + 33

        return BlockHeaderList
예제 #3
0
   def getMainHeaderAtHeight(self, height):

      key = '\x02'
      keybody = struct.pack('>I', height)
      key = key +keybody

      try:
         headers = ArmoryDB.dbheaders.Get(key)
      except:
         return None
      nheaders = struct.unpack_from('B', headers)

      pos=1
      blkkey = '\x01' + headers[pos+1:pos+33]
      val = ArmoryDB.dbheaders.Get(blkkey)
      rtBlock = PyBlockHeader()
      rtBlock.unserialize(val)
         
      return rtBlock
예제 #4
0
    def getMainHeaderAtHeight(self, height):

        key = '\x02'
        keybody = struct.pack('>I', height)
        key = key + keybody

        try:
            headers = ArmoryDB.dbheaders.Get(key)
        except:
            return None
        nheaders = struct.unpack_from('B', headers)

        pos = 1
        blkkey = '\x01' + headers[pos + 1:pos + 33]
        val = ArmoryDB.dbheaders.Get(blkkey)
        rtBlock = PyBlockHeader()
        rtBlock.unserialize(val)

        return rtBlock
예제 #5
0
    def unserialize(self, toUnpack):
        if isinstance(toUnpack, BinaryUnpacker):
            headerData = toUnpack
        else:
            headerData = BinaryUnpacker(toUnpack)

        self.headerList = []
        self.header.unserialize(headerData)
        numHeader = headerData.get(VAR_INT)
        for i in range(numHeader):
            self.headerList.append(PyBlockHeader().unserialize(headerData))
        headerData.get(VAR_INT)  # Not sure if this is even used, ever
        return self
예제 #6
0
 def __init__(self, header=PyBlockHeader(), txlist=[]):
     self.header = header
     self.txList = txlist
예제 #7
0
 def __init__(self, header=PyBlockHeader(), headerlist=[]):
     self.header = header
     self.headerList = headerlist