Net Processing: Move RelayTransaction() into PeerManager #21162

pull jnewbery wants to merge 2 commits into bitcoin:master from jnewbery:2021-02-relay-transactions-peer-manager changing 3 files +17 −15
  1. jnewbery commented at 1:12 PM on February 12, 2021: member

    This is the first part of #21160. It moves the RelayTransaction() function to be a member function of the PeerManager class. This is required in order to move the transaction inventory data into the Peer object, since Peer objects are only accessible from within PeerManager.

  2. jnewbery cross-referenced this on Feb 12, 2021 from issue Move remaining application layer data to net processing by jnewbery
  3. fanquake added the label P2P on Feb 12, 2021
  4. DrahtBot commented at 10:37 PM on February 12, 2021: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    No conflicts as of last run.

  5. DrahtBot cross-referenced this on Feb 12, 2021 from issue [refactor] Move some net_processing globals into PeerManagerImpl by ajtowns
  6. DrahtBot cross-referenced this on Feb 12, 2021 from issue RFC: Move Peer and PeerManagerImpl declarations to separate header by jnewbery
  7. DrahtBot cross-referenced this on Feb 12, 2021 from issue net: Log to net debug in MaybeDiscourageAndDisconnect except for noban and manual peers by MarcoFalke
  8. DrahtBot cross-referenced this on Feb 13, 2021 from issue test: Extend p2p_ibd_tx_relay.py to verify no-transaction are requested during IBD by ariard
  9. DrahtBot cross-referenced this on Feb 13, 2021 from issue net: make CNode::m_inbound_onion public, initialize explicitly by jonatack
  10. DrahtBot cross-referenced this on Feb 14, 2021 from issue Erlay: bandwidth-efficient transaction relay protocol by naumenkogs
  11. bitcoin deleted a comment on Feb 14, 2021
  12. DrahtBot cross-referenced this on Feb 15, 2021 from issue Make all of net_processing (and some of net) use std::chrono types by dhruv
  13. DrahtBot cross-referenced this on Feb 15, 2021 from issue Split orphan handling from net_processing into txorphanage by ajtowns
  14. jnewbery commented at 1:30 PM on February 16, 2021: member

    Rebased. This is now ready for review.

  15. jnewbery force-pushed on Feb 16, 2021
  16. jnewbery marked this as ready for review on Feb 16, 2021
  17. jnewbery marked this as a draft on Feb 17, 2021
  18. jnewbery marked this as ready for review on Feb 17, 2021
  19. jnewbery force-pushed on Feb 17, 2021
  20. jnewbery marked this as a draft on Feb 17, 2021
  21. DrahtBot cross-referenced this on Feb 18, 2021 from issue net/net processing: Move addr data into net_processing by jnewbery
  22. DrahtBot cross-referenced this on Feb 18, 2021 from issue net/net processing: Move tx inventory into net_processing by jnewbery
  23. jnewbery force-pushed on Feb 18, 2021
  24. jnewbery commented at 9:25 AM on February 18, 2021: member

    I've removed the last two commits in this PR, so this is now just moving RelayTransaction() into PeerManagerImp. The final two commits are difficult to separate from the rest of the "Move tx inventory into net_processing" change (#21160) without ugly lock taking/releasing.

  25. jnewbery marked this as ready for review on Feb 18, 2021
  26. jnewbery force-pushed on Feb 19, 2021
  27. ajtowns commented at 1:08 PM on March 3, 2021: contributor

    Concept ACK, but ignoring for now since drahtbot says it conflicts with txorphanage

  28. DrahtBot added the label Needs rebase on Mar 4, 2021
  29. [net processing] Move RelayTransaction into PeerManager
    We don't mark RelayTransaction as const. Even though it doesn't mutate
    PeerManagerImpl state, it _is_ mutating the internal state of a CNode
    object, by updating setInventoryTxToSend. In a subsequent commit, that
    field will be moved to the Peer object, which is owned by
    PeerMangerImpl.
    
    This requires PeerManagerImpl::ReattemptInitialBroadcast() to no longer
    be const.
    a38a4e8f03
  30. [net processing] Don't pass CConnman to RelayTransactions
    Use the local m_connman instead
    680eb56d82
  31. jnewbery force-pushed on Mar 4, 2021
  32. jnewbery commented at 10:24 AM on March 4, 2021: member

    Rebased

    Concept ACK, but ignoring for now since drahtbot says it conflicts with txorphanage @ajtowns txorphange merged. This is now ready for review :)

  33. in src/net_processing.h:51 in a38a4e8f03 outdated
      46 | @@ -47,6 +47,10 @@ class PeerManager : public CValidationInterface, public NetEventsInterface
      47 |      /** Whether this node ignores txs received over p2p. */
      48 |      virtual bool IgnoresIncomingTxs() = 0;
      49 |  
      50 | +    /** Relay transaction to all peers. */
      51 | +    virtual void RelayTransaction(const uint256& txid, const uint256& wtxid, const CConnman& connman)
    


    ajtowns commented at 11:59 AM on March 4, 2021:

    Hmm, I think this should be marked as const ? Even after setInventoryTxToSend is moved into Peer, updating that doesn't change PeerManagerImpl, only the contents of an object which PeerManagerImpl has a shared_ptr to. For better or worse const on a class only protects its pointers from changes, it doesn't protect the things pointed to from changing.


    jnewbery commented at 5:27 PM on March 4, 2021:

    More discussion here: #21236 (review)

  34. ajtowns commented at 12:03 PM on March 4, 2021: contributor

    Approach ACK; not convinced about the non-const bit.

  35. DrahtBot removed the label Needs rebase on Mar 4, 2021
  36. jnewbery cross-referenced this on Mar 4, 2021 from issue net processing: Extract `addr` send functionality into MaybeSendAddr() by jnewbery
  37. DrahtBot commented at 4:50 PM on March 15, 2021: contributor

    <!--4a62be1de6b64f3ed646cdc7932c8cf5-->

    🕵️ @sipa has been requested to review this pull request as specified in the REVIEWERS file.

  38. jnewbery added this to the "Blockers" column in a project

  39. ajtowns commented at 5:01 AM on March 18, 2021: contributor

    ACK 680eb56d828ce358b4e000c140f5b247ff5e6179

  40. fanquake merged this on Mar 18, 2021
  41. fanquake closed this on Mar 18, 2021

  42. jnewbery deleted the branch on Mar 18, 2021
  43. jnewbery removed this from the "Blockers" column in a project

  44. sidhujag referenced this in commit 115c5127f3 on Mar 18, 2021
  45. laanwj cross-referenced this on Mar 24, 2021 from issue [p2p] Introduce node rebroadcast module by amitiuttarwar
  46. JaredTate cross-referenced this on Oct 30, 2021 from issue WIP: Feature/8.22.0 Random Crash Bug & Missing Dandelion Relay TX Code by JaredTate
  47. jsarenik cross-referenced this on Mar 29, 2022 from issue tx inventory: Accomodate RPC change for Bitcoin Core 24 by jsarenik
  48. bitcoin locked this on Aug 18, 2022

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-05-19 05:53 UTC

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