torrent-file: Fixing bug in wireEncode that breaks the implicit digest of the data packet
Change-Id: I3cf0e79e819c9d8c915b9ef766e9346828b00e66
Refs: #3489
diff --git a/src/torrent-file.cpp b/src/torrent-file.cpp
index 4302b53..a9797fd 100644
--- a/src/torrent-file.cpp
+++ b/src/torrent-file.cpp
@@ -227,13 +227,12 @@
this->constructLongNames();
}
-const Block&
-TorrentFile::wireEncode()
+void
+TorrentFile::finalize()
{
this->createSuffixCatalog();
this->encodeContent();
m_suffixCatalog.clear();
- return Data::wireEncode();
}
} // namespace ntorrent
diff --git a/src/torrent-file.hpp b/src/torrent-file.hpp
index 89d3173..ea095ac 100644
--- a/src/torrent-file.hpp
+++ b/src/torrent-file.hpp
@@ -111,10 +111,13 @@
wireDecode(const Block& wire);
/**
- * @brief Encode from wire format
+ * @brief Finalize .torrent-file before signing the data packet
+ *
+ * This method has to be called (every time) right before signing or encoding
+ * the .torrent-file
*/
- const Block&
- wireEncode();
+ void
+ finalize();
/**
* @brief Insert a name to the catalog of file manifest names