1. We apply impulse for body at bottom. (this contact verify the condition above), all is ok. 2. We apply impulses for contact 2 at top. so it will modify the relative velocity from body 1, then the relative contact velocity 1, will invalidate the first condition.
So i dont know if it's the best techniques to resolve resting in contact.