Orphan txn: should broadcast when entering memory pool #3566

issue gavinandresen opened this issue on January 21, 2014
  1. gavinandresen commented at 6:33 PM on January 21, 2014: contributor

    Coinbase reported this issue to me many months ago, I forgot to open an issue:

    If a node receives a transaction but does not know about one of it's parents, it is added to mapOrphans (and is not relayed).

    If the parent shows up later, it is moved from mapOrphans into the memory pool. It should be relayed at that point, but is not.

    This can result in a whole chain of transactions getting stuck.

  2. jgarzik commented at 7:24 PM on January 21, 2014: contributor

    Agree with operational description: a chain of transactions can get stuck, if a dependent is not relayed, throwing all further TXs into the orphan category.

    However, that would seem to open the doors to flooding the network with orphans. The cost and difficulty of creating an orphan is very low, given that, by definition, it is impossible to validate as being connected to the chain.

  3. gavinandresen commented at 7:43 PM on January 21, 2014: contributor

    You can already flood a peer with orphans, but they are just added to mapOrphans (which is a fixed size; if it overflows a random orphan is evicted). You cannot flood the network with orphans, since they are not relayed.

    When an orphan is removed from mapOrphans and put into the memory pool (because its missing parent transaction(s) enters the memory pool), that means it is no longer an orphan. So there is no risk of flooding with orphan transactions; you are limited by the number of unspent transaction outputs you can sign and the amount you're willing to spend on transaction fees.

  4. laanwj commented at 10:32 AM on January 24, 2014: member

    ACK on the idea.

    It still only relays every transaction at most once, but possibly delayed. So it adds a 'memory' function to relaying nodes that was not there before, it used to be either relay immediately or never relay.

    Not a big issue I suppose. Nodes are not required to have this feature but it helps the network overall.

  5. coblee commented at 1:37 AM on March 1, 2014: contributor

    I took a look at the code and it seems like this is already working as intended. Gavin, can you take a look at the code and confirm? https://github.com/bitcoin/bitcoin/blob/master/src/main.cpp#L3664

  6. barmstrong commented at 11:45 PM on March 13, 2014: none

    Agreed with @coblee, seems like this may already be working as intended. Here is a link with updated line number: https://github.com/bitcoin/bitcoin/blob/master/src/main.cpp#L3733

    Can anyone think of any reason it may not be working as intended or other code paths? Thanks!

  7. laanwj added the label Brainstorming on May 2, 2014
  8. laanwj added the label Priority Medium on May 2, 2014
  9. gavinandresen closed this on Sep 5, 2014

  10. DrahtBot locked this on Sep 8, 2021

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-05-01 00:15 UTC

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