All patents granted, or homesteads allowed, shall be subject to any vested and accrued water rights, or rights to ditches and reservoirs used in connection with such water rights, as may have been acquired under or recognized by section
51 of this title.