Do this check upfront, before doing any transaction operations.