strip peerid when setting on-chain addrs

This commit is contained in:
Aayush Rajasekaran 2020-08-17 21:18:11 -04:00
parent 1bd90d0701
commit 4ef5a58b36

View File

@ -59,7 +59,14 @@ var actorSetAddrsCmd = &cli.Command{
return fmt.Errorf("failed to parse %q as a multiaddr: %w", a, err) return fmt.Errorf("failed to parse %q as a multiaddr: %w", a, err)
} }
addrs = append(addrs, maddr.Bytes()) maddrNop2p, strip := ma.SplitFunc(maddr, func(c ma.Component) bool {
return c.Protocol().Code == ma.P_P2P
})
if strip != nil {
fmt.Println("Stripping peerid ", strip, " from ", maddr)
}
addrs = append(addrs, maddrNop2p.Bytes())
} }
maddr, err := nodeAPI.ActorAddress(ctx) maddr, err := nodeAPI.ActorAddress(ctx)