Fix the case where the peer status is not updated #22913

pull fujicoin wants to merge 2 commits into bitcoin:master from fujicoin:fix210908 changing 1 files +7 −1
  1. fujicoin commented at 6:58 AM on September 8, 2021: none

    This PR is an improvement proposal to solve the problem of issue #22898 "There are cases where the peer status is not updated forever".

    I used this line: https://github.com/bitcoin/bitcoin/blob/ecf580e40f607091a5e5d5fff9865237e037ea7f/src/net_processing.cpp#L4605 because it is meaningless (always false).

  2. fix the case where the peer status is not updated 241b2cedb1
  3. naumenkogs commented at 7:26 AM on September 8, 2021: member

    fFoundStartingHeader is not necessarily false because it could be made true inside the for (const uint256& hash : peer->m_blocks_for_headers_relay) { loop, right?

    Also, if you were thinking it's always false, it would just make sense to drop fFoundStartingHeader variable altogether? After your change it's never being accessed anyway.

  4. DrahtBot added the label P2P on Sep 8, 2021
  5. revert fFoundStartingHeader 609b2cc80e
  6. fujicoin commented at 10:30 AM on September 8, 2021: none

    OK. Normally fForceSendHeaders is always true when adding a new block. It's hard to imagine an exception, but I reverted fFoundStartingHeader because something special might happen.

  7. fujicoin commented at 11:33 PM on September 9, 2021: none

    @naumenkogs The current code is designed not to send headers to peers from that we received new blocks or headers. Is this specification intentional? If so, why? I think this is probably the idea that the peer is already aware of the new block and doesn't need to be notified again. However, as long as the node has peer status information, I think it should always be correct. The current code is inappropriate in that sense. What do you think?

  8. naumenkogs commented at 8:36 AM on September 10, 2021: member

    Sorry, I'm trying to help but I'm completely lost in your code and your intentions. I'm looking at the current master code, and it does make sense to me, so I'm not sure what you're trying to change in it. Your issue, despite being very elaborate, is also confusing.

  9. fujicoin commented at 10:00 AM on September 10, 2021: none

    @naumenkogs Did you see issue #22898 ? Do you think the test results are as expected and it is fine? Do you say it's correct not to notify our status to peers who already have a new block? I'm not saying that the current code is absolutely wrong. But if it's correct to notify our status to all connected peers, then the current code is wrong.

    I built and tested v22.0 with this PR and the peer status has been improved to always show the correct status.

  10. fujicoin commented at 6:27 AM on September 11, 2021: none

    Please answer my question simply. However, it's hard to get your answer, so today I'll try another method to explain the problem.

    This is the line I think is the problem with the current code: } else if (PeerHasHeader (& state, pindex)) { https://github.com/bitcoin/bitcoin/blob/5c0f46ca46e23a161649b5150baa01020dc85e48/src/net_processing.cpp#L4608

    This if statement is true for peers that the node has already received a new block or header. So the node does not send headers to that peer. Therefore, the peer does not update the status of this node. Do you think this behavior of the node is correct?

  11. fujicoin commented at 1:06 PM on September 14, 2021: none

    @naumenkogs Are you fundamentally misunderstanding? I don't think you can't understand this simple problem. Please consider it a little more seriously.

  12. laanwj commented at 1:13 PM on December 8, 2021: member

    I think there's a language barrier or other communication problem here.

  13. MarcoFalke commented at 1:32 PM on December 8, 2021: member

    Is this an issue in the GUI that is fixed with a patch to net_processing.cpp?

  14. MarcoFalke commented at 1:39 PM on January 3, 2022: member

    Closing for now due to inactivity. It might be good to explain the problem that is fixed with clear steps to reproduce, starting from scratch, or maybe even as a (functional) test.

    Let us know when this is done, so that this pull can be reopened.

  15. MarcoFalke closed this on Jan 3, 2022

  16. DrahtBot locked this on Jan 3, 2023

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-29 03:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me