diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-09 08:08:36 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-09 08:08:36 +0000 |
| commit | 563a93a505d1588cf4c9911510107988135db62e (patch) | |
| tree | 81c827f6361679405e0f3210efca509759c56e8e /src | |
| parent | 7cc5d37cbf4f02f0bb7eee6342dc1ede5a841a7b (diff) | |
fix: MockSyncContext creates single clone tag with multiple values
The mock was creating multiple clone tags (one per URL), which violated
NIP-34 format and triggered validation errors added in commit 92bfbd3.
NIP-34 specifies: single clone tag with multiple values
["clone", "https://url1.com", "https://url2.com", ...]
NOT multiple clone tags:
["clone", "https://url1.com"]
["clone", "https://url2.com"]
This regression caused 7 purgatory::sync::functions tests to fail because
RepositoryAnnouncement::from_event() now correctly rejects announcements
with multiple clone tags.
Fixes:
- next_url_skips_throttled_domains
- next_url_skips_tried_urls
- next_url_filters_our_domain
- next_url_with_specific_domain
- get_throttled_domains_returns_only_throttled_with_untried
- sync_identifier_enqueues_throttled_domains_when_incomplete
- sync_identifier_tries_multiple_urls_until_complete
All 232 unit tests now pass.
Diffstat (limited to 'src')
| -rw-r--r-- | src/purgatory/sync/context.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/purgatory/sync/context.rs b/src/purgatory/sync/context.rs index 9e195c7..1c2d7f2 100644 --- a/src/purgatory/sync/context.rs +++ b/src/purgatory/sync/context.rs | |||
| @@ -647,12 +647,12 @@ pub mod mock { | |||
| 647 | vec!["test-repo".to_string()], | 647 | vec!["test-repo".to_string()], |
| 648 | )]; | 648 | )]; |
| 649 | 649 | ||
| 650 | for url in &self.clone_urls { | 650 | // Create a single clone tag with multiple values (NIP-34 format) |
| 651 | tags.push(nostr_sdk::Tag::custom( | 651 | let clone_values: Vec<String> = self.clone_urls.iter().cloned().collect(); |
| 652 | nostr_sdk::TagKind::Custom("clone".into()), | 652 | tags.push(nostr_sdk::Tag::custom( |
| 653 | vec![url.clone()], | 653 | nostr_sdk::TagKind::Custom("clone".into()), |
| 654 | )); | 654 | clone_values, |
| 655 | } | 655 | )); |
| 656 | 656 | ||
| 657 | let event = EventBuilder::new(Kind::from(30617), "") | 657 | let event = EventBuilder::new(Kind::from(30617), "") |
| 658 | .tags(tags) | 658 | .tags(tags) |