pub(crate) async fn deduplicate_peerstates(sql: &Sql) -> Result<()>
Expand description

Removes duplicate peerstates from acpeerstates database table.

Normally there should be no more than one peerstate per address. However, the database does not enforce this condition.

Previously there were bugs that caused creation of additional peerstates when existing peerstate could not be read due to a temporary database error or a failure to parse stored data. This procedure fixes the problem by removing duplicate records.