-
Notifications
You must be signed in to change notification settings - Fork 37.7k
Remove CTxMemPool params from ATMP #23465
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsNo conflicts as of last run. |
5c548b1
to
b028df7
Compare
b028df7
to
17eb627
Compare
17eb627
to
988cfd8
Compare
Code Review ACK 988cfd8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept ACK. This PR removes CTxMemPool pool
argument from AcceptToMemoryPool()
since it can be obtained from CChainState active_chainstate.m_mempool
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review ACK 988cfd8.
This change simplifies ATMP since chain params and the mempool are accessible from the chainstate.
It also removes the intermediate AcceptToMemoryPoolWithTime
causing all ATMP callers to explicit set accept_time, usually GetTime()
.
988cfd8
to
1d96cbc
Compare
1d96cbc
to
358f94a
Compare
I changed the approach. Now, the Not sure if this is idiomatic (c++ style). Otherwise, I can revert to original approach (with public |
358f94a
to
3f7d1c1
Compare
3f7d1c1
to
83b3697
Compare
b6489b9
to
d784d1e
Compare
d784d1e
to
2cc5a38
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approach ACK 2cc5a38, will review properly.
9e426c9
to
7503606
Compare
Co-authored-by: John Newbery <1063656+jnewbery@users.noreply.github.com> Co-authored-by: Jon Atack <jon@atack.com>
7503606
to
f1f10c0
Compare
utACK f1f10c0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left some nits in the test, but no blockers
review ACK f1f10c0 🔙
Show signature
Signature:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
review ACK f1f10c0514fe81318c8b064f9dad0e2f9a2cd037 🔙
-----BEGIN PGP SIGNATURE-----
iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUgHpQv/Zm11wrNJ2iGL1U2uf4cOLbafgx6DxBsY5Jf4VOBRhAaTSdluLEBEkhdY
eTLy4lrXuzAhrs9SS8ogJYEUT2JWn5vmfPjXdsPIyJPRVT1IEUoeelarH03oOHEe
+xW5ILkL7S8GlNGB+nUqXkq47Qw5jY+zr39v3tGvHJkrVHVhaDZOlFmPoXKDVrdv
TnsQcV8GL+4ZL9gyg6+tM26uSeDOaTId8L/4xtmzkzgcPcZqPsT/LyXxKmKDjY5s
KHyASsIIZG+Tb2M7HGAaZiPZelhhg1kyJqv0tq+woEfeE3qQ41U+r/if+kM10kmh
cKy4Jfw8lR7em5e2fVE2NDf0va6i1TVJz/8ZPYSS0C5IK8aeC+0OK2CE0GKjlP8k
n/F7rAU9BUOkerA4ccwq1T+l0FwN4yOa2d3EZobHHRDn8jSmITqwaXxZHIDyB7/3
lIHrKEoNBvdlF1ohlQNqXGSJQeb+wQ1l9EWLM0Gj/U/8WjZTyswSxAn1UBJOEabH
CzoLf3ep
=M0GN
-----END PGP SIGNATURE-----
assert(active_chainstate.GetMempool() != nullptr); | ||
CTxMemPool& pool{*active_chainstate.GetMempool()}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert(active_chainstate.GetMempool() != nullptr); | |
CTxMemPool& pool{*active_chainstate.GetMempool()}; | |
CTxMemPool& pool{*Assert(active_chainstate.GetMempool())}; |
nit: Can be written shorter
class DummyChainState final : public CChainState | ||
{ | ||
public: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class DummyChainState final : public CChainState | |
{ | |
public: | |
struct DummyChainState final : public CChainState { |
nit: Can be written shorter, but might be controversial to use struct
here. I think in tests it is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to declare this as a class, even if it requires an additional line for the access specifier (since it's a class and not just a data structure).
void SetMempool(CTxMemPool* mempool) | ||
{ | ||
m_mempool = mempool; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: mempool
is never null, so can use a reference
void SetMempool(CTxMemPool* mempool) | |
{ | |
m_mempool = mempool; | |
void SetMempool(CTxMemPool& mempool) | |
{ | |
m_mempool = &mempool; |
Post-merge ACK, modulo that I'm not sure if the CChainState::GetMempool() getter adds value. I've proposed a follow-up to remove it that picks up some of Marco's review feedback. |
f1f10c0 Remove CTxMemPool params from ATMP (lsilva01) Pull request description: Remove `CTxMemPool` parameter from `AcceptToMemoryPool` function, as suggested in bitcoin#23437 (comment) . This requires that `CChainState` has access to `MockedTxPool` in `tx_pool.cpp` as mentioned bitcoin#23173 (comment). So the `MockedTxPool` is attributed to `CChainState::m_mempool` before calling `AcceptToMemoryPool`. Requires bitcoin#23437. ACKs for top commit: jnewbery: utACK f1f10c0 MarcoFalke: review ACK f1f10c0 🔙 Tree-SHA512: 2a4885f4645014fc1fa98bb1090f13721c1a0796bc0021b9cb43bc8cc13920b6eaf057d1f5ed796e0a110e7813e41fe0196334ce7c80d1231fc057a9a3bdf349
efbb49e Remove CTxMemPool params from ATMP (lsilva01) Pull request description: Remove `CTxMemPool` parameter from `AcceptToMemoryPool` function, as suggested in bitcoin/bitcoin#23437 (comment) . This requires that `CChainState` has access to `MockedTxPool` in `tx_pool.cpp` as mentioned bitcoin/bitcoin#23173 (comment). So the `MockedTxPool` is attributed to `CChainState::m_mempool` before calling `AcceptToMemoryPool`. Requires #23437. ACKs for top commit: jnewbery: utACK efbb49e MarcoFalke: review ACK efbb49e 🔙 Tree-SHA512: 2a4885f4645014fc1fa98bb1090f13721c1a0796bc0021b9cb43bc8cc13920b6eaf057d1f5ed796e0a110e7813e41fe0196334ce7c80d1231fc057a9a3bdf349
Summary: Co-authored-by: John Newbery <1063656+jnewbery@users.noreply.github.com> Co-authored-by: Jon Atack <jon@atack.com> This is a backport of [[bitcoin/bitcoin#23465 | core#23465]] Test Plan: `ninja all check-all` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Subscribers: Fabien Differential Revision: https://reviews.bitcoinabc.org/D12457
Remove
CTxMemPool
parameter fromAcceptToMemoryPool
function, as suggested in #23437 (comment) .This requires that
CChainState
has access toMockedTxPool
intx_pool.cpp
as mentioned #23173 (comment). So theMockedTxPool
is attributed toCChainState::m_mempool
before callingAcceptToMemoryPool
.Requires #23437.