m_node
member, which has a pointer to the mempool global. Use the pointer instead of the global to prepare the removal of the mempool global. See #19556
Remove mempool global from interfaces #19848
pull MarcoFalke wants to merge 3 commits into bitcoin:master from MarcoFalke:2008-nomemint changing 3 files +41 −15-
MarcoFalke commented at 2:50 pm on August 31, 2020: memberThe chain interface has an
-
MarcoFalke added the label Refactoring on Aug 31, 2020
-
promag commented at 3:03 pm on August 31, 2020: memberCorrect me if I’m wrong but
m_node.mempool
is always set right? -
MarcoFalke commented at 3:08 pm on August 31, 2020: member
https://github.com/bitcoin/bitcoin/blob/068bc211881c790225e9979eb16ce4f44fb64e01/src/init.cpp#L1374
Currently it will be set during init until shortly before shutdown is done. Though, in the future it may be nullptr for the whole runtime of the program (see also #19629 (comment))
-
DrahtBot commented at 4:55 pm on August 31, 2020: member
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
Conflicts
Reviewers, this pull request conflicts with the following ones:
- #19872 (Avoid locking CTxMemPool::cs recursively in some cases by hebasto)
- #19572 (ZMQ: Create “sequence” notifier, enabling client-side mempool tracking by instagibbs)
- #19556 (Remove mempool global by MarcoFalke)
- #15719 (Wallet passive startup by ryanofsky)
- #12677 (RPC: Add ancestor{count,size,fees} to listunspent output by luke-jr)
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
-
hebasto commented at 5:42 pm on August 31, 2020: memberConcept ACK.
-
practicalswift commented at 7:09 pm on August 31, 2020: contributorConcept ACK
-
darosior commented at 7:19 pm on August 31, 2020: memberConcept ACK
-
jnewbery commented at 8:31 am on September 2, 2020: memberutACK fa5fa7e025164f9ac73741ece697e3ea4e7ed64c
-
in src/policy/rbf.cpp:11 in fa5fa7e025 outdated
4@@ -5,9 +5,10 @@ 5 #include <policy/rbf.h> 6 #include <util/rbf.h> 7 8-RBFTransactionState IsRBFOptIn(const CTransaction& tx, const CTxMemPool& pool) 9+namespace { 10+RBFTransactionState IsRBFOptIn(const CTransaction& tx, const CTxMemPool* const pool) NO_THREAD_SAFETY_ANALYSIS 11 { 12- AssertLockHeld(pool.cs); 13+ if (pool) AssertLockHeld(pool->cs);
hebasto commented at 5:02 pm on September 2, 2020:Could we avoid:
- adding new
NO_THREAD_SAFETY_ANALYSIS
- conditional
AssertLockHeld()
: https://clang.llvm.org/docs/ThreadSafetyAnalysis.html#no-conditionally-held-locks
?
MarcoFalke commented at 8:08 am on September 3, 2020:Fixedryanofsky approvedryanofsky commented at 5:23 pm on September 2, 2020: memberCode review ACK fa5fa7e025164f9ac73741ece697e3ea4e7ed64c. Seems good for these calls to function without a mempool. Agree with hebasto it would be nice to clean up locking assertions within IsRBFOptIn. But if that requires more invasive changes to IsRBFOptIn, it would probably be better to do it in a targeted PR before or after this one.MarcoFalke force-pushed on Sep 3, 2020MarcoFalke commented at 8:08 am on September 3, 2020: memberChanged the first commit to removeNO_THREAD_SAFETY_ANALYSIS
. Let me know if this is better or if I should revert to the initial version.in src/policy/rbf.h:27 in fa9124d935 outdated
27+ * @param tx The unconfirmed transaction 28+ * @param pool The mempool, which may contain the tx 29+ * 30+ * @return The rbf state. May be UNKNOWN for unconfirmed transactions not 31+ * in the mempool. May be REPLACEABLE_BIP125 for transactions that 32+ * conflict with an in-chain transaction.
hebasto commented at 6:38 pm on September 3, 2020:This comment lacksFINAL
value description: https://github.com/bitcoin/bitcoin/blob/fa9124d93527fd5ff741000b790a3772f2961a52/src/policy/rbf.cpp#L37
MarcoFalke commented at 6:47 am on September 4, 2020:It wasn’t the goal to documentRBFTransactionState
, but since you asked for it, I’ve done thathebasto changes_requestedhebasto commented at 6:39 pm on September 3, 2020: memberApproach ACK fa9124d93527fd5ff741000b790a3772f2961a52MarcoFalke force-pushed on Sep 4, 2020MarcoFalke commented at 6:48 am on September 4, 2020: memberfixed up and force pushed last doc commithebasto approvedhebasto commented at 6:57 am on September 4, 2020: memberACK fadb436745515f16efb1330b36e6f3831c0ac5fbin src/policy/rbf.cpp:44 in fadb436745 outdated
35@@ -36,3 +36,10 @@ RBFTransactionState IsRBFOptIn(const CTransaction& tx, const CTxMemPool& pool) 36 } 37 return RBFTransactionState::FINAL; 38 } 39+ 40+RBFTransactionState IsRBFOptInEmptyMempool(const CTransaction& tx) 41+{ 42+ static const CTxMemPool pool_empty; 43+ LOCK(pool_empty.cs); 44+ return IsRBFOptIn(tx, pool_empty);
jnewbery commented at 7:59 am on September 4, 2020:Seems like quite a roundabout way to avoid one line of code:
0 // If we don't have a local mempool we can only check the transaction itself. 1 return SignalsOptInRBF(tx) ? RBFTransactionState::REPLACEABLE_BIP125 : RBFTransactionState::UNKNOWN;
jnewbery commented at 8:01 am on September 4, 2020: memberI’m not very keen on the static const mempool and have an alternative.
ACK fadb436745515f16efb1330b36e6f3831c0ac5fb
ryanofsky approvedryanofsky commented at 7:09 pm on September 4, 2020: memberCode review ack fadb436745515f16efb1330b36e6f3831c0ac5fb. Since last review reverted changes to IsRBFOptIn with different IsRBFOptInEmptyMempool workaround. John’s third workaround seems good too.darosior approveddarosior commented at 7:14 pm on September 4, 2020: membertested ACK fadb436745515f16efb1330b36e6f3831c0ac5fb
I also prefer jnewberry’s patch, but not against merging this without it.
refactor: Add IsRBFOptInEmptyMempool
Co-authored-by: John Newbery <jonnynewbs@gmail.com>
Remove mempool global from interfaces faef4fc9b4doc: Add doxygen comment to IsRBFOptIn fa9ee52556MarcoFalke force-pushed on Sep 5, 2020MarcoFalke commented at 9:49 am on September 5, 2020: memberChanged first commit according to feedback.
darosior approveddarosior commented at 9:58 am on September 5, 2020: memberACK fa9ee52hebasto approvedjnewbery commented at 10:13 am on September 5, 2020: memberutACK fa9ee52556MarcoFalke merged this on Sep 5, 2020MarcoFalke closed this on Sep 5, 2020
MarcoFalke deleted the branch on Sep 5, 2020deadalnix referenced this in commit d4e8a4c13f on Jul 15, 2021DrahtBot locked this on Feb 15, 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-19 00:12 UTC
This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me - adding new