8000 mempool, refactor: add `MemPoolBypass` by w0xlt · Pull Request #25577 · bitcoin/bitcoin · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Closed
wants to merge 8 commits into from

Conversation

w0xlt
Copy link
Contributor
@w0xlt w0xlt commented Jul 9, 2022

#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 and test_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.

@DrahtBot
Copy link
Contributor
DrahtBot commented Jul 9, 2022

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #25757 (rpc: add a new parameter desriptor_file to importdescriptors RPC by w0xlt)
  • #25747 (rpc: add a new parameter save_to_file to listdescriptors RPC by w0xlt)
  • #25648 (refactor: Remove all policy globals by MarcoFalke)
  • #24007 ([mempool] allow tx replacement by smaller witness by LarryRuane)

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.


if (!request.params[1].isNull()) {
const UniValue& options = request.params[1];
RPCTypeCheckObj(options,
Copy link
Member

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

Copy link
Contributor Author

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,
Copy link
Member

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

Copy link
Contributor Author

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) :
Copy link
Member

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.

Copy link
Contributor Author

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'

Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 30555e7.

@w0xlt w0xlt force-pushed the add_mempoolbypass branch from 26ee1a4 to 151c4d2 Compare July 17, 2022 04:03
@w0xlt
Copy link
Contributor Author
w0xlt commented Jul 17, 2022

@luke-jr Thanks for the review. #25577 (comment) and #25577 (comment) have been addressed in the new push.

@@ -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"},
Copy link
Member

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

Copy link
Contributor Author

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 \"*\"."},

Copy link
Member

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, "",

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 841c77b.

@w0xlt w0xlt force-pushed the add_mempoolbypass branch from fe628c4 to 863fb97 Compare July 24, 2022 06:48
@w0xlt
Copy link
Contributor Author
w0xlt commented Jul 24, 2022

@luke-jr I added the suggested commit and changed the parameter to "options|maxfeerate.

@glozow
Copy link
Member
glozow commented Aug 1, 2022

Unclear to me how beneficial this refactor is, see contrib guidelines on refactoring.

@w0xlt
Copy link
Contributor Author
w0xlt commented Aug 1, 2022

@glozow This refactoring adds the options parameter to testmempoolaccept and also keeps the original parameter. This is only useful if more parameters are added to this RPC, such as #25434.

As there is no consensus for #25434 (or #25532 and #25570), I will close this PR for now.

@w0xlt w0xlt closed this Aug 1, 2022
@bitcoin bitcoin locked and limited conversation to collaborators Aug 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0