A pays B to perform some task.
Before B can complete performance,
A takes actions which make Bís performance of the contract,
more difficult or improbable and maybe even impossible.
B has spent his pay attempting to perform.
Is this still a valid contract ?
Does B have to repay A ?
What legal principles are involved here ?