Skip to content

Remove mempool expiry, treat txs as replaceable instead - #16409

Closed
maflcko wants to merge 2 commits into
bitcoin:masterfrom
maflcko:1907-noExpiryButReplace
Closed

maflcko wants to merge 2 commits into
bitcoin:masterfrom
maflcko:1907-noExpiryButReplace

Conversation

@maflcko

@maflcko maflcko commented Jul 17, 2019

Copy link
Copy Markdown
Member

There is no reason for tx expiry in the tx pool, as wallets occasionally rebroadcast txs when they are not confirmed. Thus they will only reset the timer and throw away their chance bumping the fee.

Fix that by removing expiry (so that miners don't miss out on long-term fee revenue if the tx stays the same), but treat all txs older than 2 weeks as replaceable in the mempool to give wallets the chance to increase the fee.

@maflcko

maflcko commented Jul 17, 2019

Copy link
Copy Markdown
Member Author

Will write:

  • doc
  • rpc changes
  • tests

if this gets more than zero Concept ACKs

@sipa

sipa commented Jul 17, 2019

Copy link
Copy Markdown
Member

There is a nontrivial policy change here (I think; haven't checked the code) which may or may not be desirable: replacing a transaction is subject to the "replacement pays marginal extra fee for relay of now non-confirming old transaction", while clearly new submissions after expiry are not subject to this.

In other words, replacement isn't guaranteed to converge to the highest fee-paying state in the long term, as the optimal state may be so close to a suboptimal earlier one that replacement isn't allowed. However, this isn't an issue right now as expiry will eventually remove non-comfirming things, allowing them to be replaced for free. With this change, that is no longer the case.

An alternative would be to after some age, drop this minimum marginal rate rule, or even making it decay over time.

@DrahtBot

DrahtBot commented Jul 18, 2019 •

Copy link
Copy Markdown
Contributor

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #16421 (Conservatively accept RBF bumps bumping one tx at the package limits by TheBlueMatt)
  • #16401 (Package relay by sdaftuar)
  • #16400 ([refactor] Rewrite AcceptToMemoryPoolWorker() using smaller parts by sdaftuar)
  • #16398 (rpc: testmempoolaccept for list of transactions by MarcoFalke)
  • #15921 (Tidy up ValidationState interface by jnewbery)
  • #15681 ([mempool] Allow one extra single-ancestor transaction per package by TheBlueMatt)
  • #15192 (Add missing cs_main locks in ThreadImport(...)/Shutdown(...)/gettxoutsetinfo(...)/InitScriptExecutionCache(). Add missing locking annotations. by practicalswift)
  • #10443 (Add fee_est tool for debugging fee estimation code by ryanofsky)

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.

@sdaftuar

Copy link
Copy Markdown
Member

I think there's another reason to have mempool expiry -- if there is a policy change adopted by miners in the future, then software that doesn't enforce the policy rule and that lack any kind of mempool expiry might keep transactions violating the rule in their mempools forever.

@maflcko

maflcko commented Jul 18, 2019

Copy link
Copy Markdown
Member Author

In other words, replacement isn't guaranteed to converge to the highest fee-paying state in the long term, as the optimal state may be so close to a suboptimal earlier one that replacement isn't allowed

I think you are focussing too much on a currently theoretical use case that is not applicable in today's network. And assuming that miners are running with mempool expiry to support your use case, they have no way to protect against the case where they are sent a replacement transaction that has less fees. (Expiry will completely erase the tx and any feerates associated with it)

If you look at use cases that have been observable on the current network, my change seems like a clear improvement: Assume that a tx hasn't confirmed after 2 weeks, so the original wallet has a few options:

With my proposed changes:

    1. Miners have no incentive to throw away income, so this gives a false sense of security and my changes would make it explicit that the tx is still alive.
    1. Rebroadcasting might hurt privacy and imposes a cost on the network, so might as well keep the tx in the first place (as is done with my changes)
    1. .
      a) Again, miners don't have an incentive to throw away income, so this is fragile. My changes would prevent it from happening
      b) Imo a theoretical use case. If miners are willing to accept marginally more fee they can reduce the -minincrementalfee. And I think a fee decay should be done in a follow up pull request. Though, I am happy to "drop this minimum marginal rate rule" as suggested by you, if others think this is helpful.
      c) Bad actors on the network can starve propagation of those txs by just flooding out the original tx. Again, my change would prevent that from happening.

@sdaftuar

Copy link
Copy Markdown
Member

@MarcoFalke Regarding the fee difference between expiry and marking something replaceable -- if a small, low-feerate transaction is RBF-pinned with a large, low-feerate descendant (for instance, created by someone else), then with this proposal, the original transaction author has no way to RBF the transaction without spending a lot of fee, correct?

While expiry doesn't guarantee that the original transaction author will be able to replace it with a nominally higher feerate in the future (ie without having to pay for all descendants), my guess would be that this should generally work.

@maflcko

maflcko commented Jul 18, 2019

Copy link
Copy Markdown
Member Author

might keep transactions violating the rule in their mempools forever

Expiry does not protect against that, as anyone can connect to you once every two weeks and re-send you the txs you just dropped. Also, if you are running an EOL release of Bitcoin Core, you are encouraged to only connect it to trusted peers that run a recent version of Bitcoin Core.

@maflcko

maflcko commented Jul 18, 2019

Copy link
Copy Markdown
Member Author

then with this proposal, the original transaction author has no way to RBF the transaction without spending a lot of fee, correct?

Yes

@jnewbery

Copy link
Copy Markdown
Contributor

@sdaftuar has convinced me. Mempool expiry is a useful feature, if only to protect old nodes from having their mempools permanently filled with transactions that are fail policy for newer nodes. I don't see that the benefit from this PR outweighs the potential risk of old nodes having their mempools filled with effectively unconfirmable txs.

Concept NACK.

@DrahtBot

Copy link
Copy Markdown
Contributor
Needs rebase

@maflcko

maflcko commented Jul 19, 2019

Copy link
Copy Markdown
Member Author

Thanks for the input everyone. I will close this for now based on @sdaftuar's and @jnewbery's feedback.

@maflcko maflcko closed this Jul 19, 2019
@maflcko
maflcko deleted the 1907-noExpiryButReplace branch July 19, 2019 22:57
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Dec 16, 2021
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.

7 participants