-
Notifications
You must be signed in to change notification settings - Fork 37.4k
mempool, refactor: add MemPoolBypass
#25577
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. ConflictsReviewers, this pull request conflicts with the following ones:
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. |
a5a17cf
to
26ee1a4
Compare
|
||
if (!request.params[1].isNull()) { | ||
const UniValue& options = request.params[1]; | ||
RPCTypeCheckObj(options, |
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.
Should have backward compatibility for now
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.
Done in 618a792.
int64_t accept_time, | ||
bool bypass_limits, | ||
const int64_t accept_time, | ||
const std::optional<MemPoolBypass>& mempool_bypass, |
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.
Probably better to just have a constexpr noop MemPoolBypass
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.
Could you elaborate more ? I don´t see how constexpr
fits in this case.
src/validation.h
Outdated
|
||
MemPoolBypass() {} | ||
|
||
MemPoolBypass(bool test_accept, bool bypass_limits) : |
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.
Prefer limiting this to designated initializers, or otherwise explicit assignment.
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 originally used only C++ 20 designated initializers in this PR, but it crashes on one (and only one) CI check (error C7555 on a Windows machine, if I remember correctly).
Something like:
error C7555: use of designated initializers requires at least '/std:c++20'
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.
We now use C++20 on that CI, so they should work 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.
Done in 30555e7.
@luke-jr Thanks for the review. #25577 (comment) and #25577 (comment) have been addressed in the new push. |
src/rpc/mempool.cpp
Outdated
@@ -98,7 +98,15 @@ static RPCHelpMan testmempoolaccept() | |||
}, | |||
}, | |||
{"maxfeerate", RPCArg::Type::AMOUNT, RPCArg::Default{FormatMoney(DEFAULT_MAX_RAW_TX_FEE_RATE.GetFeePerK())}, | |||
"Reject transactions whose fee rate is higher than the specified value, expressed in " + CURRENCY_UNIT + "/kvB\n"}, | |||
"(deprecated. Use \"options\" instead) Reject transactions whose fee rate is higher than the specified value, expressed in " + CURRENCY_UNIT + "/kvB\n"}, |
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.
Replacing the option is fine. Only need to tolerate the old param type.
Might need to pull in 0996496
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.
Are you suggesting something like the dummy
argument in getbalance()
?
RPCHelpMan getbalance()
{
....
{"dummy", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "Remains for backward compatibility. Must be excluded or set to \"*\"."},
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.
No, more like this:
{"options|maxfeerate", {RPCArg::Type::OBJ, RPCArg::Type::AMOUNT}, RPCArg::Optional::OMITTED_NAMED_ARG, "",
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.
Done in 841c77b.
Author: Luke Dashjr <luke-jr+git@utopios.org>
`maxfeerate` becomes a member of an "options" object rather than a positional argument. The idea is that any new parameters in the future will also go into options.
@luke-jr I added the suggested commit and changed the parameter to |
Unclear to me how beneficial this refactor is, see contrib guidelines on refactoring. |
#25434, #25532 and #25570 add some parameters to bypass some mempool checks. The motivations for each parameter can be found in these PRs.
#25434 (comment) suggested to allocate the existing mempool parameters
bypass_limits
andtest_accept
in the same structure.This PR makes that change without introducing new behaviors or new assumptions. It is basically a refactor and will be used as basis for the new parameters in the PRs mentioned above.