File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,8 @@ import (
15
15
core "github.com/ipfs/go-ipfs/core"
16
16
"github.com/ipfs/go-ipfs/core/commands"
17
17
fsrepo "github.com/ipfs/go-ipfs/repo/fsrepo"
18
- namesys "github.com/ipfs/go-namesys"
18
+ path "github.com/ipfs/go-path"
19
+ unixfs "github.com/ipfs/go-unixfs"
19
20
20
21
cmds "github.com/ipfs/go-ipfs-cmds"
21
22
config "github.com/ipfs/go-ipfs-config"
@@ -245,5 +246,19 @@ func initializeIpnsKeyspace(repoRoot string) error {
245
246
}
246
247
defer nd .Close ()
247
248
248
- return namesys .InitializeKeyspace (ctx , nd .Namesys , nd .Pinning , nd .PrivateKey )
249
+ emptyDir := unixfs .EmptyDirNode ()
250
+
251
+ // pin recursively because this might already be pinned
252
+ // and doing a direct pin would throw an error in that case
253
+ err = nd .Pinning .Pin (ctx , emptyDir , true )
254
+ if err != nil {
255
+ return err
256
+ }
257
+
258
+ err = nd .Pinning .Flush (ctx )
259
+ if err != nil {
260
+ return err
261
+ }
262
+
263
+ return nd .Namesys .Publish (ctx , nd .PrivateKey , path .FromCid (emptyDir .Cid ()))
249
264
}
You can’t perform that action at this time.
0 commit comments