def local_garbage_collect(self, commandnumber):
        """
        Truncates decisions, executed and proposals
        up to given commandnumber
        """
        keys = sorted(self.decisions.keys())
        # Sanity checking
        lastkey = keys[0]
        candelete = True
        for cmdno in keys:
            if cmdno == lastkey:
                lastkey += 1
            else:
                candelete = False
                break
        # Truncating
        if not candelete:
            return False
        for cmdno in keys:
            if commandnumber < cmdno:
                if self.decisions[cmdno] in self.executed:
                    del self.executed[self.decisions[cmdno]]
                    try:
                        del self.proposals[cmdno]
                    except:
                        pass
                    #del self.decisions[cmdno]
                else:
                    break
        return True

# LEADER STATE
dataset/ETHPy150Open denizalti/concoord/concoord/replica.py/Replica.local_garbage_collect/swapped operands of `<`