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
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
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
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
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
def __init__(self, header=PyBlockHeader(), txlist=[]): self.header = header self.txList = txlist
def __init__(self, header=PyBlockHeader(), headerlist=[]): self.header = header self.headerList = headerlist