It is unclear what the goal of the helper is, as the caller already knows the spend height before calling the helper.
Also, in case the coins view is corrupted, LookupBlockIndex will return nullptr. Dereferencing a nullptr is UB.
Fix both issues by removing it. Also, add a sanity check, which aborts if the coins view is corrupted.
This is a backport of core#23630