diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-08 00:50:54 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-08 00:50:54 +0000 |
| commit | f75e1c59aacf5ce668fd327e4e3d827511661c2a (patch) | |
| tree | 867926c7503e7c587e86c67896a9e7347600447b /src/nostr | |
| parent | 3f14f998d64b5fa15bdddd7570b4f72874eb9f29 (diff) | |
chore: cargo fmt
Diffstat (limited to 'src/nostr')
| -rw-r--r-- | src/nostr/builder.rs | 9 | ||||
| -rw-r--r-- | src/nostr/policy/pr_event.rs | 1 | ||||
| -rw-r--r-- | src/nostr/policy/state.rs | 10 |
3 files changed, 13 insertions, 7 deletions
diff --git a/src/nostr/builder.rs b/src/nostr/builder.rs index 0e5c18a..81f7fbb 100644 --- a/src/nostr/builder.rs +++ b/src/nostr/builder.rs | |||
| @@ -162,7 +162,11 @@ impl Nip34WritePolicy { | |||
| 162 | match self.state_policy.validate(event) { | 162 | match self.state_policy.validate(event) { |
| 163 | StateResult::Accept => { | 163 | StateResult::Accept => { |
| 164 | // Process state alignment asynchronously | 164 | // Process state alignment asynchronously |
| 165 | match self.state_policy.process_state_event(event, is_synced).await { | 165 | match self |
| 166 | .state_policy | ||
| 167 | .process_state_event(event, is_synced) | ||
| 168 | .await | ||
| 169 | { | ||
| 166 | Ok(poilicy_result) => poilicy_result, | 170 | Ok(poilicy_result) => poilicy_result, |
| 167 | Err(e) => { | 171 | Err(e) => { |
| 168 | tracing::warn!("Failed to process state event {}: {}", event_id_str, e); | 172 | tracing::warn!("Failed to process state event {}: {}", event_id_str, e); |
| @@ -247,7 +251,8 @@ impl Nip34WritePolicy { | |||
| 247 | ); | 251 | ); |
| 248 | return WritePolicyResult::Reject { | 252 | return WritePolicyResult::Reject { |
| 249 | status: false, | 253 | status: false, |
| 250 | message: "invalid: previously expired from purgatory without git data".into(), | 254 | message: "invalid: previously expired from purgatory without git data" |
| 255 | .into(), | ||
| 251 | }; | 256 | }; |
| 252 | } | 257 | } |
| 253 | 258 | ||
diff --git a/src/nostr/policy/pr_event.rs b/src/nostr/policy/pr_event.rs index 9942a6a..00e09c3 100644 --- a/src/nostr/policy/pr_event.rs +++ b/src/nostr/policy/pr_event.rs | |||
| @@ -237,5 +237,4 @@ impl PrEventPolicy { | |||
| 237 | 237 | ||
| 238 | Ok(repo_paths) | 238 | Ok(repo_paths) |
| 239 | } | 239 | } |
| 240 | |||
| 241 | } | 240 | } |
diff --git a/src/nostr/policy/state.rs b/src/nostr/policy/state.rs index 7bbb379..acb76a3 100644 --- a/src/nostr/policy/state.rs +++ b/src/nostr/policy/state.rs | |||
| @@ -9,8 +9,8 @@ use nostr_relay_builder::builder::WritePolicyResult; | |||
| 9 | use nostr_relay_builder::prelude::Event; | 9 | use nostr_relay_builder::prelude::Event; |
| 10 | 10 | ||
| 11 | use super::PolicyContext; | 11 | use super::PolicyContext; |
| 12 | use crate::git::authorization::fetch_repository_data; | ||
| 13 | use crate::git; | 12 | use crate::git; |
| 13 | use crate::git::authorization::fetch_repository_data; | ||
| 14 | use crate::nostr::events::{validate_state, RepositoryAnnouncement, RepositoryState}; | 14 | use crate::nostr::events::{validate_state, RepositoryAnnouncement, RepositoryState}; |
| 15 | 15 | ||
| 16 | /// Result of state policy evaluation | 16 | /// Result of state policy evaluation |
| @@ -48,7 +48,11 @@ impl StatePolicy { | |||
| 48 | /// * `is_synced` - True if this event came from proactive sync (vs user-submitted) | 48 | /// * `is_synced` - True if this event came from proactive sync (vs user-submitted) |
| 49 | /// | 49 | /// |
| 50 | /// Returns the true if git data already availale or false if added to purgatory | 50 | /// Returns the true if git data already availale or false if added to purgatory |
| 51 | pub async fn process_state_event(&self, event: &Event, is_synced: bool) -> Result<WritePolicyResult> { | 51 | pub async fn process_state_event( |
| 52 | &self, | ||
| 53 | event: &Event, | ||
| 54 | is_synced: bool, | ||
| 55 | ) -> Result<WritePolicyResult> { | ||
| 52 | // Parse state to get HEAD and branch info | 56 | // Parse state to get HEAD and branch info |
| 53 | let state = | 57 | let state = |
| 54 | RepositoryState::from_event(event.clone()).context("Failed to parse state event")?; | 58 | RepositoryState::from_event(event.clone()).context("Failed to parse state event")?; |
| @@ -155,8 +159,6 @@ impl StatePolicy { | |||
| 155 | }) | 159 | }) |
| 156 | } | 160 | } |
| 157 | } | 161 | } |
| 158 | |||
| 159 | |||
| 160 | } | 162 | } |
| 161 | 163 | ||
| 162 | fn find_repo_with_git_data( | 164 | fn find_repo_with_git_data( |