Skip to content

Commit

Permalink
convert v0 cids to v1 when providing
Browse files Browse the repository at this point in the history
  • Loading branch information
n8maninger committed Mar 21, 2024
1 parent 138b30a commit a2006f7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ipfs/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ func (n *Node) PeerID() peer.ID {

// Provide broadcasts a CID to the network
func (n *Node) Provide(c cid.Cid) error {
if c.Version() == 0 {
v1Cid := cid.NewCidV1(c.Type(), c.Hash())
if err := n.provider.Provide(v1Cid); err != nil {
return fmt.Errorf("failed to provide v1 CID: %w", err)
}
}
return n.provider.Provide(c)
}

Expand Down

0 comments on commit a2006f7

Please sign in to comment.