def get(self, hash_and_pc, rtx): res = self.txos.get_by_hash(sha256(hash_and_pc), rtx=rtx) if not res: raise KeyError(hash_and_pc) utxo = IOput() utxo.deserialize_with_context(res) utxo.set_verified_and_correct() #Trust saved outputs return utxo
def remove(self, n, wtx): self.commitments.remove(n, wtx=wtx) ser_removed_outputs = self.txos.remove(n, wtx=wtx) removed_outputs = [] for _ser in ser_removed_outputs: utxo = IOput() utxo.deserialize_with_context(_ser) removed_outputs.append(utxo) return removed_outputs
def find(self, hash_and_pc, rtx): ''' In contrast with __getitem__ find will try to find even spent outputs for other (syncing) nodes. ''' res = self.txos.find_by_hash(sha256(hash_and_pc), rtx=rtx) if not res: raise KeyError(hash_and_pc) utxo = IOput() utxo.deserialize_with_context(res) utxo.set_verified_and_correct() #Trust saved outputs return utxo