The Mayor of Casterbridge

A man sells his wife and child to a sailor, remarries on becoming mayor, and learns his daughter is actually the sailor's.