def get(key, readOnly): if readOnly: if key in PersistentStorage.storage: return PersistentStorage.storage[key] value = PersistentStorage.persistent.get(RLP.encode(key)) if value != None: value = RLP.decode(value) PersistentStorage.storage[key] = value return value else: value = PersistentStorage.persistent.get(RLP.encode(key)) if value != None: return RLP.decode(value) return None
def verifyCoinbaseWitnessLength(self, transaction): if transaction.isCoinbase(): txIn = transaction.inputs[0] witness = txIn.witness witnessEncoded = RLP.encode(witness) if len(witnessEncoded) < 2 or len(witnessEncoded) > 100: return False return True
def serialize(self): item = [ self.host, self.version, self.lastVersionNonce, self.chainHeadBlockHash, self.lastUpdate ] return RLP.encode(item)
def serialize(self, includeWitness=True): witnesses = [] if includeWitness: for txIn in self.inputs: witnesses.append(txIn.witness) item = [ self.version, self.gasLimit, self.gasPrice, self.inputs, self.outputs, witnesses ] return RLP.encode(item)
def serialize(self): item = [ self.type, self.version, self.timestamp, self.nonce, self.chainHeadBlockHash ] return RLP.encode(item)
def serialize(self): item = [self.type, self.version, self.blockHashes] return RLP.encode(item)
def serialize(self): item = [self.address, self.script, self.value, self.extraData] return RLP.encode(item)
def serialize(self): inventory = [] for inv in self.inventory: inventory.append(inv.serialize()) item = [self.type, inventory] return RLP.encode(item)
def serialize(self): item = [self.txId, self.outputIndex] return RLP.encode(item)
def serialize(self): item = [self.type, self.addrList] return RLP.encode(item)
def serialize(self): item = [self.invType, self.invHash] return RLP.encode(item)
def remove(key, readOnly): if readOnly: if key in PersistentStorage.storage: PersistentStorage.storage.pop(key) else: PersistentStorage.persistent.remove(RLP.encode(key))
def add(key, value, readOnly): if readOnly: PersistentStorage.storage[key] = value else: PersistentStorage.persistent.set(RLP.encode(key), RLP.encode(value))
def serialize(self): item = [ self.type, self.transaction, ] return RLP.encode(item)
def serializeHeader(self): header = self.getHeader() return RLP.encode(header)
def serialize(self): item = [self.chainWork, self.previousHash, self.gasLimit, self.height] return RLP.encode(item)
def serialize(self): item = self.getHeader() item.append(self.getBody()) return RLP.encode(item)
def serialize(self): item = [self.type] return RLP.encode(item)
def serialize(self): item = [self.outpoint] return RLP.encode(item)
def serialize(self): item = [self.output, self.txOutputSize, self.height, self.coinbase] return RLP.encode(item)
def serialize(self): item = [ self.type, self.block, ] return RLP.encode(item)