Skip to content

p2p: fix logging peer address #2773

@ebuchman

Description

@ebuchman

Pointed out in #2721 (comment)

module=p2p peer=0xb78f00

It's because we're passing a function pointer rather than calling the function in:

p.SetLogger(sw.Logger.With("peer", p.NodeInfo().NetAddress().String))

We should just pass the NetAddress() there, no need to call String().

But note even if we do that, we still lose the ID. That's because in

func removeProtocolIfDefined(addr string) string {
if strings.Contains(addr, "://") {
return strings.Split(addr, "://")[1]
}
return addr
we expect the protocol to be at the beginning, but it could come after the @, eg. 76e35576b8dd1cf8049fea382fda8ac621a9c6ee@tcp://0.0.0.0:26656. So we need fix this too

Metadata

Metadata

Assignees

No one assigned

    Labels

    C:p2pComponent: P2P pkgT:bugType Bug (Confirmed)good first issueContributions Welcome!!

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions