-
Notifications
You must be signed in to change notification settings - Fork 37.7k
rpc: Allow to ignore specific policy reject reasons #20753
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
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.
What's the goal of reinventing this rather than just reopening and reviewing #7533 (which is still maintained)?
@@ -49,7 +49,7 @@ static void AssembleBlock(benchmark::Bench& bench) | |||
|
|||
for (const auto& txr : txs) { | |||
TxValidationState state; | |||
bool ret{::AcceptToMemoryPool(*test_setup.m_node.mempool, state, txr, nullptr /* plTxnReplaced */, false /* bypass_limits */)}; | |||
bool ret{::AcceptToMemoryPool(*test_setup.m_node.mempool, state, txr, nullptr /* plTxnReplaced */, {} /* ignore_rejects */, false /* 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.
IMO the const empty_ignore_rejects is cleaner.
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. |
faa81c6
to
fa2b393
Compare
I think this needs more motivation. Without a strong reason to do this, I tend to agree with the comments on #7533:
|
The reasons can only change if the server version changes. And the policy reject reasons may already change in all other RPCs (e.g. |
To extend my reply a bit: Currently it is only possible to override the baked-in behavior for some very specific policy checks via command line (e.g. Simply having broader categories (or even a single category) doesn't solve the problem that policy changes between versions. |
(Concept ACK, will review code in detail later) |
Concept NACK on exposing this for mainnet. That seems like a huge footgun, even with the warning. What is the use case? We should never treat our own transactions differently than ones coming from the network. I think it's pretty ugly in any case, but can imagine it's useful for testing. |
One use case is to accept a transaction as a miner that has a large fee, but violates a policy limit (e.g. tx-version, dust, ...) and thus has issues to propagate the network and be accepted to the likely-default mempool the miner is running. If someone is using this without thinking, it might lead to issues, just like |
Where is the footgun? Many policies are based on DoS risk, which doesn't exist if there's a user actively trying to add a transaction. As for use cases, I know one real-world case where a user accidentally used an uncompressed key for a segwit address. He's figured out his mistake, and in theory he should be able to recover his coins, but he hasn't convinced any miners (last I checked) to modify their software to accept it. (This PR might not be enough to get that one past, but it demonstrates that there are legitimate needs to override policies.) |
I can imagine a user wanting to look at a transaction just based on consensus rules and not policy... |
Correct, the transaction won't relay typically. (Unless you know that you are running an old version of Bitcoin Core to relay a tx that future versions of Bitcoin Core consider policy-"valid", but this is probably an edge case). Thus, I think the primary user of this feature is a miner. (And maybe some power users that know exactly what they are doing).
I am happy to explore this direction. Though, Another option would be for |
This is how a miner would accept it directly.
This seems like a good idea regardless. |
Ah ok. Then, wrt maintainability, it still seems simpler to just set policy on/off entirely?
That sounds nice. Although I'd say it's tricky to implement - what we might consider individual policies aren't really mutually exclusive and we usually stop after the first violation because later checks would break / say the same thing but be more expensive. For example too small or scriptSig size. Would we run |
Absolutely agree with this. Mempool acceptance logic should be optimized towards simplicity and performance. Making the internal logic more complex so that we can return additional debugging information over an interface that we can't guarantee to be stable doesn't seem like the right decision to me. |
The policy rejection reasons should live in ./src/policy, just like the other policy rejection reasons (e.g. IsStandardTx)
This is a pure refactor to pass ignore_rejects from the sendrawtransaction and testmempoolaccept RPCs to policy. Only default-constructed (empty) sets are passed and never used, so this doesn't change behavior.
fa2b393
to
2876005
Compare
We already return the failure reason, and it is already not stable, so this wouldn't change anything fundamentally. Also, this doesn't change performance of mempool acceptance logic if not enabled. Yes, it might run checks that aren't mutually exclusive, but what is the problem with that if the user explicitly asks to do that. A user might also rescan the wallet in a loop, even though it has already been rescanned. |
🐙 This pull request conflicts with the target branch and needs rebase. Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a "draft". |
There hasn't been much activity lately and the patch still needs rebase. What is the status here?
|
1 similar comment
There hasn't been much activity lately and the patch still needs rebase. What is the status here?
|
The
-acceptnonstdtxn
footgun is only enabled for regtest/testnet due to several shortcomings:This pull adds a new optional RPC parameter to ignore specific reject reasons for a specific tx.