Do not set bridge-stats-end for relay case to published time
When parsing extrainfo descriptors and populating our DB we do (among other things) something like this:
if (this.isBridge == true) {
preparedStatement.setTimestamp(17,
new Timestamp(desc.getBridgeStatsEndMillis()));
preparedStatement.setLong(18,
desc.getBridgeStatsIntervalLength());
preparedStatement.setString(19,
descUtils.fieldAsString(desc.getBridgeIps()));
preparedStatement.setString(20,
descUtils.fieldAsString(desc.getBridgeIpVersions()));
preparedStatement.setString(21,
descUtils.fieldAsString(desc.getBridgeIpTransports()));
} else {
preparedStatement.setTimestamp(17,
new Timestamp(desc.getPublishedMillis()));
However, the code in the else clause is wrong as the spec says:
A "bridge-stats-end" line, as well as any other "bridge-*" line, is only added when the relay has been running as a bridge for at least 24 hours.
So, the naive assumption would be, if we have a relay's extrainfo descriptor we don't have that line at all and hence should not set some unrelated date. Thinking about what would happen if you switch your bridge to a relay after running it for 24h makes me pause, though, questioning the whole isBridge
check. I think what we should do is just treating the "bridge-*" lines as any other line and set them according to what we get from the descriptor regardless whether we believe it stems from a bridge or not. That way we just avoid any corner case and populate the DB with the data according to what we get in the descriptor, which is what one might expect.