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-
jnewbery commented at 1:12 pm on February 12, 2021: memberThis 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.
-
fanquake added the label P2P on Feb 12, 2021
-
DrahtBot commented at 10:37 pm on February 12, 2021: member
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
Conflicts
No conflicts as of last run.
-
MarcoFalke deleted a comment on Feb 14, 2021
-
jnewbery commented at 1:30 pm on February 16, 2021: memberRebased. This is now ready for review.
-
jnewbery force-pushed on Feb 16, 2021
-
jnewbery marked this as ready for review on Feb 16, 2021
-
jnewbery marked this as a draft on Feb 17, 2021
-
jnewbery marked this as ready for review on Feb 17, 2021
-
jnewbery force-pushed on Feb 17, 2021
-
jnewbery marked this as a draft on Feb 17, 2021
-
jnewbery force-pushed on Feb 18, 2021
-
jnewbery commented at 9:25 am on February 18, 2021: memberI’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.
-
jnewbery marked this as ready for review on Feb 18, 2021
-
jnewbery force-pushed on Feb 19, 2021
-
ajtowns commented at 1:08 pm on March 3, 2021: memberConcept ACK, but ignoring for now since drahtbot says it conflicts with txorphanage
-
DrahtBot added the label Needs rebase on Mar 4, 2021
-
[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.
-
[net processing] Don't pass CConnman to RelayTransactions
Use the local m_connman instead
-
jnewbery force-pushed on Mar 4, 2021
-
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 asconst
? Even aftersetInventoryTxToSend
is moved intoPeer
, updating that doesn’t changePeerManagerImpl
, only the contents of an object whichPeerManagerImpl
has ashared_ptr
to. For better or worseconst
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)ajtowns commented at 12:03 pm on March 4, 2021: memberApproach ACK; not convinced about the non-const bit.DrahtBot removed the label Needs rebase on Mar 4, 2021jnewbery added this to the "Blockers" column in a project
ajtowns commented at 5:01 am on March 18, 2021: memberACK 680eb56d828ce358b4e000c140f5b247ff5e6179fanquake merged this on Mar 18, 2021fanquake closed this on Mar 18, 2021
jnewbery deleted the branch on Mar 18, 2021jnewbery removed this from the "Blockers" column in a project
sidhujag referenced this in commit 115c5127f3 on Mar 18, 2021DrahtBot 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: 2024-12-18 15:12 UTC
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: 2024-12-18 15:12 UTC
This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me
More mirrored repositories can be found on mirror.b10c.me