IsRBFOptIn check for ancestors flagging BIP125 #18141

issue sidhujag opened this issue on February 13, 2020
  1. sidhujag commented at 7:33 PM on February 13, 2020: none

    Hi there,

    Please help me understand the following code: https://github.com/bitcoin/bitcoin/blob/master/src/policy/rbf.cpp#L25

    It checks for ancestors flagging replaceability for RBF detection which is seemingly only used from utility and rpc commands. However note the mempool policy: https://github.com/bitcoin/bitcoin/blob/master/src/validation.cpp#L772

    It seems as though relay won't happen if you are replacing inputs from ancestors anyway, so why does IsRBFOptIn need to check for ancestors? Do we need that or can we simply just use SignalsOptInRBF which just checks the tx inputs to ensure they aren't replaceable and not ancestral checks?

  2. sidhujag added the label Bug on Feb 13, 2020
  3. uncleray95 commented at 11:47 AM on February 19, 2020: none

    I believe this is done to address a potential "transaction pinning attack", but I could be wrong. There's a good comment on StackOverflow that describes the problem here.

  4. sidhujag commented at 5:58 AM on February 23, 2020: none

    How is it an attack? the commercial service would sweet up outputs and spend them with higher fees but both should get mined because the fee rate of the package would be sufficient to mine... what is the actual attack? Also this is still just replacing the input of the child transaction and nothing to do with any ancestor? I was saying that the mempool acceptance code just ensures that ancestor inputs cannot be replaced and why does a function need to then check for them, I can't see how a pinning attack has anything to do with ancestors rather than just the child in question...

  5. sidhujag commented at 6:12 AM on February 23, 2020: none

    If someone can clarify how its an attack (like it wont get mined because its on the tx fee limit?), carve out still ensure LN works, what sorts of things would not be available to someone?

    "Because descendant transactions may also be replaceable under this policy through inherited signaling, any method used to process opt-in full-RBF transactions should be inherited by any descendant transactions for as long as any ancestor opt-in full-RBF transactions remain unconfirmed." from the BIP is probably why the function exists, but I thought the code was saying that your not allowed to replace any other input in ancestor tree, where is the code that allows you to spend inputs that are in mempool as ancestors as long as one of them signals RBF?

  6. adamjonas removed the label Bug on Aug 2, 2022
  7. adamjonas added the label TX fees and policy on Aug 2, 2022
  8. glozow commented at 8:56 AM on August 3, 2022: member

    Not sure what code the link is pointing to in the OP, as it points to master >2 years ago, but will try to answer your question.

    It seems as though relay won't happen if you are replacing inputs from ancestors anyway, so why does IsRBFOptIn need to check for ancestors?

    IsRBFOptIn checks ancestors to answer the question of "can this transaction be replaced by RBF rules." If the ancestor is replaced, this tx is also evicted because it would no longer be valid. It's not checking whether the ancestors would signal/be replaced.

    If someone can clarify how its an attack (like it wont get mined because its on the tx fee limit?), carve out still ensure LN works, what sorts of things would not be available to someone?

    This is not related to a pinning attack.

    Closing now, hopefully this answers your question. We've added a doc/policy/mempool_replacements.md and more documentation since then if you have more questions about RBF.

  9. glozow closed this on Aug 3, 2022

  10. bitcoin locked this on Aug 3, 2023

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-17 09:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me