Skip to content

Commit 8690c1a

Browse files
committed
TMP: fix up post-cherry-pick
1 parent 2c376aa commit 8690c1a

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

message/ipldbind/message.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ type GraphSyncExtensions struct {
4747
// GraphSyncRequest is a struct to capture data on a request contained in a
4848
// GraphSyncMessage.
4949
type GraphSyncRequest struct {
50-
Id graphsync.RequestID
50+
Id []byte
5151

5252
Root cid.Cid
5353
Selector ipld.Node
@@ -65,7 +65,7 @@ type GraphSyncMetadatum struct {
6565
// GraphSyncResponse is an struct to capture data on a response sent back
6666
// in a GraphSyncMessage.
6767
type GraphSyncResponse struct {
68-
Id graphsync.RequestID
68+
Id []byte
6969

7070
Status graphsync.ResponseStatusCode
7171
Metadata []GraphSyncMetadatum

message/message.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ func (gsm GraphSyncMessage) ToIPLD() (*ipldbind.GraphSyncMessage, error) {
218218
ibm.Requests = make([]ipldbind.GraphSyncRequest, 0, len(gsm.requests))
219219
for _, request := range gsm.requests {
220220
ibm.Requests = append(ibm.Requests, ipldbind.GraphSyncRequest{
221-
Id: request.id,
221+
Id: request.id.Bytes(),
222222
Root: request.root,
223223
Selector: request.selector,
224224
Priority: request.priority,
@@ -231,7 +231,7 @@ func (gsm GraphSyncMessage) ToIPLD() (*ipldbind.GraphSyncMessage, error) {
231231
ibm.Responses = make([]ipldbind.GraphSyncResponse, 0, len(gsm.responses))
232232
for _, response := range gsm.responses {
233233
ibm.Responses = append(ibm.Responses, ipldbind.GraphSyncResponse{
234-
Id: response.requestID,
234+
Id: response.requestID.Bytes(),
235235
Status: response.status,
236236
// Extensions: response.extensions,
237237
})
@@ -252,13 +252,21 @@ func messageFromIPLD(ibm *ipldbind.GraphSyncMessage) (GraphSyncMessage, error) {
252252
requests := make(map[graphsync.RequestID]GraphSyncRequest, len(ibm.Requests))
253253
for _, req := range ibm.Requests {
254254
// exts := req.Extensions
255-
requests[graphsync.RequestID(req.Id)] = newRequest(graphsync.RequestID(req.Id), req.Root, req.Selector, graphsync.Priority(req.Priority), req.Cancel, req.Update, nil)
255+
id, err := graphsync.ParseRequestID(req.Id)
256+
if err != nil {
257+
return GraphSyncMessage{}, err
258+
}
259+
requests[id] = newRequest(id, req.Root, req.Selector, graphsync.Priority(req.Priority), req.Cancel, req.Update, nil)
256260
}
257261

258262
responses := make(map[graphsync.RequestID]GraphSyncResponse, len(ibm.Responses))
259263
for _, res := range ibm.Responses {
260264
// exts := res.Extensions
261-
responses[graphsync.RequestID(res.Id)] = newResponse(graphsync.RequestID(res.Id), graphsync.ResponseStatusCode(res.Status), nil)
265+
id, err := graphsync.ParseRequestID(res.Id)
266+
if err != nil {
267+
return GraphSyncMessage{}, err
268+
}
269+
responses[id] = newResponse(id, graphsync.ResponseStatusCode(res.Status), nil)
262270
}
263271

264272
blks := make(map[cid.Cid]blocks.Block, len(ibm.Blocks))

0 commit comments

Comments
 (0)