Skip to content

Commit

Permalink
register nmt codec to the global ipfs codec maps
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-forbes committed Mar 15, 2021
1 parent 9501248 commit c270849
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions p2p/ipld/plugin/nodes/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ const (

// Nmt is the codec used for leaf and inner nodes of an Namespaced Merkle Tree.
Nmt = 0x7700

// NmtCodecName is the name used during registry of the Nmt codec
NmtCodecName = "nmt-inner-or-leaf-node"

// Sha256Namespace8Flagged is the multihash code used to hash blocks
// that contain an NMT node (inner and leaf nodes).
Sha256Namespace8Flagged = 0x7701
Expand All @@ -51,6 +55,9 @@ func init() {
)
// this should already happen when the plugin is injected but it doesn't for some CI tests
format.DefaultBlockDecoder.Register(Nmt, NmtNodeParser)
// register the codecs in the global maps
cid.Codecs[NmtCodecName] = Nmt
cid.CodecToStr[Nmt] = NmtCodecName
}

func mustRegisterNamespacedCodec(
Expand Down

0 comments on commit c270849

Please sign in to comment.