p2p: require all addresses come with an ID no matter what#1352
p2p: require all addresses come with an ID no matter what#1352
Conversation
291dd0c to
ee3e40d
Compare
ee3e40d to
2f87965
Compare
Codecov Report
@@ Coverage Diff @@
## develop #1352 +/- ##
===========================================
+ Coverage 61.66% 61.79% +0.13%
===========================================
Files 114 114
Lines 11012 10993 -19
===========================================
+ Hits 6790 6793 +3
+ Misses 3574 3564 -10
+ Partials 648 636 -12
|
| // NewNetAddressStringWithIDRequired returns a new NetAddress using the provided | ||
| // address in the form of "ID@IP:Port". | ||
| // Also resolves the host if host is not an IP. | ||
| func NewNetAddressString(addr string) (*NetAddress, error) { |
There was a problem hiding this comment.
Did you forget to change the name or should that name doc be reverted to NewNetAddressString from NewNetAddressStringWithIDRequired?
| idBytes, err := hex.DecodeString(idStr) | ||
| if err != nil { | ||
| return nil, errors.Wrap(err, fmt.Sprintf("Address (%s) contains invalid ID", addr)) | ||
| return nil, errors.Wrapf(err, "Address (%s) contains invalid ID", addrWithoutProtocol) |
There was a problem hiding this comment.
new lib is almost ready tendermint/tmlibs#180. but let's not wait here please
There was a problem hiding this comment.
Cool cool, that was fast with how that new errors package was started and it is almost complete.
|
|
||
| func TestNewNetAddressStrings(t *testing.T) { | ||
| addrs, errs := NewNetAddressStrings([]string{"127.0.0.1:8080", "127.0.0.2:8080"}) | ||
| addrs, errs := NewNetAddressStrings([]string{ |
There was a problem hiding this comment.
Could we also test some invalid addresses? The current test just confirms the always expected case.
p2p/netaddress.go
Outdated
| return NewNetAddressStringWithOptionalID(addr) | ||
| } | ||
|
|
||
| // NewNetAddressStringWithIDRequired returns a new NetAddress using the provided |
There was a problem hiding this comment.
Minor nit, the name in the doc doesn't match the actual function name:
- NewNetAddressStringWithIDRequired
- NewNetAddressStringWithOptionalID
…rmint#1352) Signed-off-by: Thane Thomson <connect@thanethomson.com>
Refs #1228