Skip to content

node: fix a bug where nil is recorded as node's address#3740

Merged
melekes merged 3 commits intodevelopfrom
3716-our-address
Jun 21, 2019
Merged

node: fix a bug where nil is recorded as node's address#3740
melekes merged 3 commits intodevelopfrom
3716-our-address

Conversation

@melekes
Copy link
Contributor

@melekes melekes commented Jun 20, 2019

Solution

AddOurAddress when we know it
sw.NetAddress is nil in createAddrBookAndSetOnSwitch
it's set by n.transport.Listen function, which is called during start

Fixes #3716

  • Updated all relevant documentation in docs
  • Updated all code comments where relevant
  • Wrote tests
  • Updated CHANGELOG_PENDING.md

@melekes melekes requested review from ebuchman and xla as code owners June 20, 2019 17:46
Solution

  AddOurAddress when we know it
  sw.NetAddress is nil in createAddrBookAndSetOnSwitch
  it's set by n.transport.Listen function, which is called during start

Fixes #3716
@melekes melekes force-pushed the 3716-our-address branch from 9c6a03f to a6f59f8 Compare June 20, 2019 17:48
Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK but test_cover fails.

@codecov-io
Copy link

codecov-io commented Jun 20, 2019

Codecov Report

Merging #3740 into develop will increase coverage by <.01%.
The diff coverage is 40%.

@@             Coverage Diff             @@
##           develop    #3740      +/-   ##
===========================================
+ Coverage    63.92%   63.93%   +<.01%     
===========================================
  Files          241      241              
  Lines        19984    19981       -3     
===========================================
  Hits         12774    12774              
+ Misses        6167     6165       -2     
+ Partials      1043     1042       -1
Impacted Files Coverage Δ
node/node.go 62.95% <40%> (-0.87%) ⬇️
privval/signer_remote.go 80% <0%> (-2%) ⬇️
libs/clist/clist.go 66.66% <0%> (-1.52%) ⬇️
types/protobuf.go 89% <0%> (-1.44%) ⬇️
consensus/state.go 79.73% <0%> (-0.83%) ⬇️
consensus/replay.go 70.2% <0%> (-0.82%) ⬇️
consensus/reactor.go 71.47% <0%> (-0.47%) ⬇️
state/tx_filter.go 100% <0%> (ø) ⬆️
p2p/pex/pex_reactor.go 81.47% <0%> (+0.58%) ⬆️
blockchain/pool.go 82.23% <0%> (+1.97%) ⬆️
... and 3 more

addrBook.SetLogger(p2pLogger.With("book", config.P2P.AddrBookFile()))

// Add ourselves to addrbook to prevent dialing ourselves
addrBook.AddOurAddress(sw.NetAddress())
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sw.NetAddress is nil at this point. It's populated by transport#Listen, which is called during node#OnStart

@melekes melekes merged commit 1b5110e into develop Jun 21, 2019
@melekes melekes deleted the 3716-our-address branch June 21, 2019 05:30
unclezoro pushed a commit to unclezoro/tendermint that referenced this pull request Sep 6, 2019
…#3740)

* node: fix a bug where `nil` is recorded as node's address

Solution

  AddOurAddress when we know it
  sw.NetAddress is nil in createAddrBookAndSetOnSwitch
  it's set by n.transport.Listen function, which is called during start

Fixes tendermint#3716

* use addr instead of n.sw.NetAddress

* add both ExternalAddress and ListenAddress as our addresses
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants