From b892db894da69cc12c92773cf6ca54d92437c66d Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Mon, 20 May 2019 14:29:26 -0700 Subject: [PATCH 1/2] dep: update go-multiaddr Forbids empty multiaddr, fixes #6354 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 3ac7a83ea6a..e7e0894a8ef 100644 --- a/go.mod +++ b/go.mod @@ -97,7 +97,7 @@ require ( github.com/miekg/dns v1.1.8 // indirect github.com/mitchellh/go-homedir v1.1.0 github.com/mr-tron/base58 v1.1.2 - github.com/multiformats/go-multiaddr v0.0.3 + github.com/multiformats/go-multiaddr v0.0.4 github.com/multiformats/go-multiaddr-dns v0.0.2 github.com/multiformats/go-multiaddr-net v0.0.1 github.com/multiformats/go-multibase v0.0.1 diff --git a/go.sum b/go.sum index a9fe47fd0e9..1f1131b30ca 100644 --- a/go.sum +++ b/go.sum @@ -559,8 +559,8 @@ github.com/multiformats/go-multiaddr v0.0.1 h1:/QUV3VBMDI6pi6xfiw7lr6xhDWWvQKn9u github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= github.com/multiformats/go-multiaddr v0.0.2 h1:RBysRCv5rv3FWlhKWKoXv8tnsCUpEpIZpCmqAGZos2s= github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.3 h1:/m5AmBtzEOIb9aY6o5pVuSwZeeCWrFks1MlqYsmHlBs= -github.com/multiformats/go-multiaddr v0.0.3/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= +github.com/multiformats/go-multiaddr v0.0.4 h1:WgMSI84/eRLdbptXMkMWDXPjPq7SPLIgGUVm2eroyU4= +github.com/multiformats/go-multiaddr v0.0.4/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= github.com/multiformats/go-multiaddr-dns v0.0.2 h1:/Bbsgsy3R6e3jf2qBahzNHzww6usYaZ0NhNH3sqdFS8= github.com/multiformats/go-multiaddr-dns v0.0.2/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= From 3aef795c9e3e8ea42ed2099e9f1c0c9f9b818a58 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Mon, 20 May 2019 14:57:23 -0700 Subject: [PATCH 2/2] commands/p2p(fix): avoid creating empty multiaddrs --- core/commands/p2p.go | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/core/commands/p2p.go b/core/commands/p2p.go index 78aa2cf3211..387b05c3707 100644 --- a/core/commands/p2p.go +++ b/core/commands/p2p.go @@ -357,14 +357,22 @@ var p2pCloseCmd = &cmds.Command{ proto := protocol.ID(protoOpt) - listen, err := ma.NewMultiaddr(listenOpt) - if err != nil { - return err + var ( + target, listen ma.Multiaddr + ) + + if l { + listen, err = ma.NewMultiaddr(listenOpt) + if err != nil { + return err + } } - target, err := ma.NewMultiaddr(targetOpt) - if err != nil { - return err + if t { + target, err = ma.NewMultiaddr(targetOpt) + if err != nil { + return err + } } if !(closeAll || p || l || t) {