Sync up the two implementation of Database<>::LatestTreeHead.

Also use the CHECK family of macros instead of assert(), to make sure they are always active (if one of these things aren't true, something is very, very wrong!).

See also: https://codereview.appspot.com/160770045/