check_verified_properties(): Don't ignore fails of Peerstate::set_verified()

- Return Result from set_verified() so that it can't be missed.
- Pass Fingerprint to set_verified() by value to avoid cloning it inside. This optimises out an
  extra clone() if we already have a value that can be moved at the caller side. However, this may
  add an extra clone() if set_verified() fails, but let's not optimise the fail scenario.
This commit is contained in:
iequidoo
2023-01-04 22:39:29 -03:00
committed by iequidoo
parent 57d7df530b
commit 8dc6ff268d
4 changed files with 38 additions and 38 deletions

View File

@@ -2178,10 +2178,10 @@ async fn check_verified_properties(
if let Some(fp) = fp {
peerstate.set_verified(
PeerstateKeyType::GossipKey,
&fp,
fp,
PeerstateVerifiedStatus::BidirectVerified,
contact.get_addr().to_owned(),
);
)?;
peerstate.save_to_db(&context.sql).await?;
is_verified = true;
}