-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Encapsulate options for mempool policy #7557
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
This code is an adaption of jtimon's commit 3d03f15 for turning policy globals into attributes of a policy class.
|
This fails Travis because As a side note, it wasn't clear to me how to easily find what had failed Travis. |
|
@MarcoFalke I don't have a strong opinion on |
|
Would you consider using jtimon@6de4f55 ? Althought this has many similarities with #6423 and some with https://github.com/jtimon/bitcoin/commits/policy-minrelayfee-0.12.99 , I'm having a hard time undesrtanding the differences. The reason for InitFromArgs and AppendMessagesOpt (apart from code encapsulation) is a feature that @luke-jr requested in #6068, #5595 or some other of the multiple failed attempts at creating a policy class, and it is exlained on the widely-ignored #6423: "Also (although I'm not going to continue that GUI part), making policy options GUI-configurable (and hopefully, in the future all new existing and new options "for free") would be very nice too. Since here the methods are modified to not allow such feature, it is indeed somewhat surprising that the methods have been maintained very similar nonetheless. Other things I don't understand are the elimination of the CPolicy abstract class from #6068 (I thought the whole point of encapsulating the policy code under an interface was to make it easier for people to maintain multiple implementations of that interface in parallel), and the rename to MempoolPolicy. You say
What do you have in mind instead? Is there any longer branch using this that I can see so that I can see "the big picture" of how you intent to use this in the future? What will be the relationship between MempoolPolicy, CBlockPolicyEstimator and CTxMemPool ? |
|
@jtimon I need to do some work around minRelayTxFee because it is broken now in CTxMemPool (supposed to respect the command line option but is hard coded) and I was having same problem in the fee filter code. So I'd like to get something merged to do this policy encapsulation so we can fix that properly and probably add a second variable for the incremental relay rate. I have no strong opinions about the way to do this encapsulation. I spent a little bit of time looking for updated versions of your encapsulation code and wasn't sure where your latest thinking was. The reason I broke off mempool policy separately is I thought it was smaller, touched less thnigs and might be easier to get merged. I'm more than happy to follow your lead if you want to do this differently. Edit: To answer your last question I was assuming both CTxMemPool and CBlockPolicyEstimator would depend on MempoolPolicy which would not depend on either of them. |
Another option would be to start CPolicy and CDefaultPolicy like in #6423 , but just with the GetMinRelayFeeRate() method instead of ApproveTx [ from IsStandardTx ] and ApproveTxInputs [from AreInputsStandard ]. And doing it in policy/policy, no need to have two separate files and classes. I'm assuming this minRelayFee will remain static for use in CDefaultPolicy::ApproveTx() and dust checks (/me remembers #5114, jtimon@dc1b96d , jtimon@5f519c2 and a long, etc, and sighs...). If it's something planned to be dynamic I believe the estimator would be a better place. I would also maintain the previously mentioned feature of making it easy for the GUI layer to dynamically create forms to configure all the policy options. I assume you removed the parameter in InitFromArgs() because you didn't knew what was about.
IIRC you previously wanted the policy to depend on CTxMemPool. Great, this is much closer to what I want. My ideal choice would be: My preference is that CDefaultPolicy extends CBlockPolicyEstimator (see jtimon@f64df9f ), that is between the 2 they fully implement the CPolicy interface, but CBlockPolicyEstimator is, in principle, an abstract class as it doesn't implement all the pure virtual methods in CPolicy. Neither CBlockPolicyEstimator nor CDefaultPolicy would depend on CTxMempool, but CTxMempool would initially depend on the CPolicy interface. Then decouple CTxMempool from CPolicy (see #7145 ). That way implementors of alternatives to CDefaultPolicy don't need to know or touch CTxMempool's internals to implement their own policies. We really don't need to decide that now, my fear was that you wanted to separate MempoolPolicy from CPolicy and CDefaultPolicy because you knew I didn't want CDefaultPolicy to depend on CTxMemPool, but maybe I was ok with a separate MempoolPolicy depending on CTxMemPool.
|
|
Needs rebase maybe after #7691 is merged. |
|
Closing hopefully to make way for other attempts |
@jtimon this is another step I wanted to take in the direction of getting policy stuff more separated.
The first commit heavily borrows from your work to separate policy, but I was aiming for organizing more around fee/relay related stuff as opposed to transaction standardness. It wasn't clear to me if those should all go together.
It touched a lot of files to get minRelayTxFee separated out, but now it should be easier to add other options.