bitswap: add wantlist fullness to protobuf messages
License: MIT Signed-off-by: Jeromy <why@ipfs.io>
Jeromy committed
Dec 2, 2016 at 14:15 UTC
6f8dd03e07d17ef97fa49255f64a3bd6801338b0
2 files changed
+6
exchange/bitswap/message/message.go
+2
@@ -189,6 +189,7 @@ func (m *impl) ToProtoV0() *pb.Message {
189
Cancel: proto.Bool(e.Cancel),
190
})
191
}
192
+ pbm.Wantlist.Full = proto.Bool(m.full)
193
for _, b := range m.Blocks() {
194
pbm.Blocks = append(pbm.Blocks, b.RawData())
195
}
@@ -205,6 +206,7 @@ func (m *impl) ToProtoV1() *pb.Message {
206
Cancel: proto.Bool(e.Cancel),
207
})
208
}
209
+ pbm.Wantlist.Full = proto.Bool(m.full)
210
for _, b := range m.Blocks() {
211
blk := &pb.Message_Block{
212
Data: b.RawData(),
exchange/bitswap/message/message_test.go
+4
@@ -118,6 +118,10 @@ func TestToNetFromNetPreservesWantList(t *testing.T) {
118
t.Fatal(err)
119
}
120
121
+ if !copied.Full() {
122
+ t.Fatal("fullness attribute got dropped on marshal")
123
+ }
124
+
125
keys := make(map[string]bool)
126
for _, k := range copied.Wantlist() {
127
keys[k.Cid.KeyString()] = true