Skip to content

Commit

Permalink
fix: clarify comments re dag-cbor extension data
Browse files Browse the repository at this point in the history
As per dission in #338, we are going
to be erroring on extension data that is not properly dag-cbor encoded from now
on
  • Loading branch information
rvagg committed Feb 2, 2022
1 parent 6b86c3c commit 7e6b198
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions message/v1/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,8 @@ func (mh *MessageHandler) newMessageFromProto(p peer.ID, pbm *pb.Message) (messa
return message.NewMessage(requests, responses, blks), nil
}

// TODO: is this a breaking protocol change? force all extension data into dag-cbor?
// Note that even for protocol v1 we now only support DAG-CBOR encoded extension data.
// Anything else will be rejected with an error.
func toEncodedExtensions(part MessagePartWithExtensions) (map[string][]byte, error) {
names := part.ExtensionNames()
out := make(map[string][]byte, len(names))
Expand All @@ -264,7 +265,6 @@ func toEncodedExtensions(part MessagePartWithExtensions) (map[string][]byte, err
return out, nil
}

// TODO: is this a breaking protocol change? force all extension data into dag-cbor?
func fromEncodedExtensions(in map[string][]byte) ([]graphsync.ExtensionData, error) {
if in == nil {
return []graphsync.ExtensionData{}, nil
Expand Down

0 comments on commit 7e6b198

Please sign in to comment.