Skip to content

Conversation

@maflcko
Copy link
Member

@maflcko maflcko commented Jul 29, 2019

Currently, the reason for the boolean bip125-replaceable is not given. However, future versions of Bitcoin Core (or software forks of Bitcoin Core) might offer different mempool (replacement) policies to their users. So instead of a flat boolean, it would be nice to return the reason why bip125-replaceable is true or false. This pull does that among a refactoring commit.

@DrahtBot
Copy link
Contributor

DrahtBot commented Jul 31, 2019

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

Conflicts

Reviewers, 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.

@maflcko maflcko force-pushed the 1907-rpcMempoolWhyReplacable branch from fa32d57 to fad333b Compare August 6, 2019 17:35
@laanwj
Copy link
Member

laanwj commented Aug 14, 2019

Concept ACK

@maflcko maflcko force-pushed the 1907-rpcMempoolWhyReplacable branch from fad333b to fa12ae2 Compare August 14, 2019 11:51
@maflcko maflcko closed this Aug 14, 2019
@maflcko maflcko reopened this Aug 14, 2019
@maflcko maflcko force-pushed the 1907-rpcMempoolWhyReplacable branch 3 times, most recently from faa21f2 to fa728ba Compare August 20, 2019 18:21
@maflcko
Copy link
Member Author

maflcko commented Aug 20, 2019

Added test

@luke-jr
Copy link
Member

luke-jr commented Sep 2, 2019

BIP 125 is pretty straightforward... Any other policy isn't BIP 125.

It would be incorrect for "bip125-replacable" to show true/false based on anything other than BIP 125.

If we want to be clearer with regard to different policies, we need a new boolean too. Or just a string/null field. A string that doesn't answer the main "is this replacable?" question isn't very helpful.

Also, avoid direct access to mapTx
@maflcko maflcko force-pushed the 1907-rpcMempoolWhyReplacable branch 3 times, most recently from fa0104d to fa0bead Compare September 5, 2019 01:33
@maflcko
Copy link
Member Author

maflcko commented Sep 5, 2019

Ok, made it a new optional string, without modifying existing return values

@maflcko maflcko changed the title rpc: Report reason for 'bip125-replaceable' value rpc: Report reason for replaceable txpool transactions Sep 5, 2019
Copy link
Contributor

@fjahr fjahr left a comment

Choose a reason for hiding this comment

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

tested and code review ACK

Conceptually, I think I would have liked it a little more if replaceable was a boolean and then there was another string field replaceable-reason, similar to reject-reason in the testmempoolaccept RPC. Is it realistic that we could remove bip125-replaceable then in the future? If that is an option I would prefer it but I don't know how many users might rely on bip125-replaceable.

@maflcko maflcko force-pushed the 1907-rpcMempoolWhyReplacable branch from fa0bead to fa35085 Compare October 11, 2019 18:41
@maflcko maflcko force-pushed the 1907-rpcMempoolWhyReplacable branch from fa35085 to fa5d55d Compare October 11, 2019 18:57
@maflcko
Copy link
Member Author

maflcko commented Oct 11, 2019

Ok, changed to what @fjahr suggested

@fjahr
Copy link
Contributor

fjahr commented Oct 12, 2019

tested ACK fa5d55d

Copy link
Contributor

@promag promag left a comment

Choose a reason for hiding this comment

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

Concept ACK and from a quick look fa5d55d LGTM.

Copy link
Contributor

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

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

Code review ACK fa5d55d. Current travis error seems like spurious lint error.

@maflcko
Copy link
Member Author

maflcko commented Oct 18, 2019

This has three ACKs, so I will probably merge it in the next few days unless there are objections.

@sdaftuar
Copy link
Member

This change seems premature to me -- it only seems to make sense in a world where we've updated our actual policy rules to include other-than-bip-125 replacement, which we've not done (yet).

In the meantime, having an extra "replaceable" field on top of "bip-125-replaceable" seems like it will confuse our users. I don't think we should make a change like this in a release where bip 125 replacement is the only thing we support.

@ryanofsky
Copy link
Contributor

seems like it will confuse our users

Might be less confusing to mark the old field as deprecated, and maybe start the process of removing it with deprecation flags.

If policy rules are likely to be updated in the future, updating the RPC interface sooner that could allow writing more robust RPC client code that won't have to change later. If I were writing RPC client code and knew there were going to be changes to the interface, I'd want more time to develop and test against those changes rather than less.

@sdaftuar
Copy link
Member

@ryanofsky If we had consensus to change our policy rules, then I'd agree that marking the old field as deprecated would make sense to allow people to prepare. But I think the issue has been that we haven't reached that consensus yet (I believe several PRs in the last year or two that proposed new replacement policies have stalled out or been closed).

@ryanofsky
Copy link
Contributor

Achieving consensus about changing policy rules and achieving consensus about future-proofing an RPC seem like things that could be done separately. That'd probably be my inclination, so I'd keep my previous ACK here. But I don't have a very strong opinion, and really just wanted to add the practical suggestion to document the less general field as deprecated to avoid confusion, or at least mention the difference between the two fields in the documentation.

}

boost::optional<CTxMemPool::txiter> CTxMemPool::GetIter(const uint256& txid) const
Optional<CTxMemPool::txiter> CTxMemPool::GetIter(const uint256& txid) const
Copy link
Contributor

Choose a reason for hiding this comment

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

Please rebase as this change is already in master.

@DrahtBot
Copy link
Contributor

DrahtBot commented Mar 4, 2020

Needs rebase

// If this transaction is not in our mempool, then we can't be sure
// we will know about all its inputs.
if (!pool.exists(tx.GetHash())) {
const Optional<CTxMemPool::txiter> it = pool.GetIter(tx.GetHash());
Copy link
Member

Choose a reason for hiding this comment

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

@mjdietzx
Copy link
Contributor

Concept ACK fa46f68

I think I am a concept NACK fa5d55d, along the lines of @luke-jr 's initial comment here

@maflcko maflcko closed this Feb 25, 2022
@maflcko maflcko deleted the 1907-rpcMempoolWhyReplacable branch February 25, 2022 13:57
@bitcoin bitcoin locked and limited conversation to collaborators Feb 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.