mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-28 05:47:51 +08:00
bitswap: add wantlist fullness to protobuf messages
License: MIT Signed-off-by: Jeromy <why@ipfs.io>
This commit is contained in:
parent
a542dea5de
commit
6f8dd03e07
@ -189,6 +189,7 @@ func (m *impl) ToProtoV0() *pb.Message {
|
||||
Cancel: proto.Bool(e.Cancel),
|
||||
})
|
||||
}
|
||||
pbm.Wantlist.Full = proto.Bool(m.full)
|
||||
for _, b := range m.Blocks() {
|
||||
pbm.Blocks = append(pbm.Blocks, b.RawData())
|
||||
}
|
||||
@ -205,6 +206,7 @@ func (m *impl) ToProtoV1() *pb.Message {
|
||||
Cancel: proto.Bool(e.Cancel),
|
||||
})
|
||||
}
|
||||
pbm.Wantlist.Full = proto.Bool(m.full)
|
||||
for _, b := range m.Blocks() {
|
||||
blk := &pb.Message_Block{
|
||||
Data: b.RawData(),
|
||||
|
||||
@ -118,6 +118,10 @@ func TestToNetFromNetPreservesWantList(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if !copied.Full() {
|
||||
t.Fatal("fullness attribute got dropped on marshal")
|
||||
}
|
||||
|
||||
keys := make(map[string]bool)
|
||||
for _, k := range copied.Wantlist() {
|
||||
keys[k.Cid.KeyString()] = true
|
||||
|
||||
Loading…
Reference in New Issue
Block a user