From 88213461ede54446879486a888cc54c583c997e3 Mon Sep 17 00:00:00 2001 From: Jose Celano Date: Tue, 19 Sep 2023 12:33:25 +0100 Subject: [PATCH] doc: add some comments for BEP 30 implementation --- src/models/torrent_file.rs | 1 + src/services/torrent_file.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/models/torrent_file.rs b/src/models/torrent_file.rs index a7e98bb4..aba633c5 100644 --- a/src/models/torrent_file.rs +++ b/src/models/torrent_file.rs @@ -216,6 +216,7 @@ impl TorrentInfoDictionary { // a torrent file has a root hash or a pieces key, but not both. if root_hash > 0 { + // If `root_hash` is true the `pieces` field contains the `root hash` info_dict.root_hash = Some(pieces.to_owned()); } else { let buffer = into_bytes(pieces).expect("variable `torrent_info.pieces` is not a valid hex string"); diff --git a/src/services/torrent_file.rs b/src/services/torrent_file.rs index 1a1dd933..338ba6e6 100644 --- a/src/services/torrent_file.rs +++ b/src/services/torrent_file.rs @@ -14,7 +14,7 @@ pub struct CreateTorrentRequest { pub pieces: String, pub piece_length: i64, pub private: Option, - pub root_hash: i64, + pub root_hash: i64, // True (1) if it's a BEP 30 torrent. pub files: Vec, // Other fields of the root level metainfo dictionary pub announce_urls: Vec>,