From: Matt Joiner <anacrolix@gmail.com>
Date: Tue, 2 Dec 2014 05:33:38 +0000 (-0600)
Subject: Reuse the info bytes when marshalling torrent metainfo
X-Git-Tag: v1.0.0~1440
X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=c41919807e495999f7ba493c933f573b9ffca30a;p=btrtrc.git

Reuse the info bytes when marshalling torrent metainfo
---

diff --git a/torrent.go b/torrent.go
index 5d13d6a9..8e909a09 100644
--- a/torrent.go
+++ b/torrent.go
@@ -370,9 +370,13 @@ func (t *torrent) AnnounceList() (al [][]string) {
 }
 
 func (t *torrent) MetaInfo() *metainfo.MetaInfo {
+	if t.MetaData == nil {
+		panic("info bytes not set")
+	}
 	return &metainfo.MetaInfo{
 		Info: metainfo.InfoEx{
-			Info: *t.Info.Info,
+			Info:  *t.Info.Info,
+			Bytes: t.MetaData,
 		},
 		CreationDate: time.Now().Unix(),
 		Comment:      "dynamic metainfo from client",