fn should_keep_new_backup(
current_backup: Option<&KeyBackupData>,
new_backup: &KeyBackupData,
) -> boolExpand description
Checks whether we should replace an existing backup’s data with the given new one.
First, if there is no existing current backup, we of course want to keep the new one.
Then, the rules to decide whether to keep the existing one or to replace it are:
- If the keys have different values for
is_verified, keep the one whichis_verified = true - Otherwise if they are identical, keep the key with the lowest
first_message_index - Otherwise if they are identical, keep the key with the lowest
forwarded_count