Defer inserting into maprelay until just before relaying. #8082

pull gmaxwell wants to merge 1 commits into bitcoin:master from gmaxwell:just_in_time_maprelay changing 3 files +30 −31
  1. gmaxwell commented at 9:48 am on May 21, 2016: contributor
    This reduces the rate of not founds by better matching the far end expectations, it also improves privacy by removing the ability to use getdata to probe for a node having a txn before it has been relayed.
  2. in src/main.cpp: in ef5854122b outdated
    5900+                    if (pto->pfilter && !pto->pfilter->IsRelevantAndUpdate(tx)) continue;
    5901                     pto->filterInventoryKnown.insert(hash);
    5902                     vInv.push_back(inv);
    5903+                    {
    5904+                        LOCK(cs_mapRelay);
    5905+                        if (mapRelay.find(inv.hash) == mapRelay.end()) {
    


    sipa commented at 9:52 am on May 21, 2016:

    More efficient:

    0auto ret = mapRelay.insert(std::make_pair(inv.hash, tx));
    1if (ret.second) {
    2    vRelayExpiration.push_back(std::make_pair(GetTime() + 16 * 60, inv.hash));
    3}
    

    gmaxwell commented at 10:04 am on May 21, 2016:
    Done.
  3. MarcoFalke commented at 11:07 am on May 21, 2016: member
    Looks like comparison tool triggers a POTENTIAL DEADLOCK DETECTED
  4. laanwj added the label P2P on May 21, 2016
  5. gmaxwell commented at 1:27 pm on May 21, 2016: contributor
    @MarcoFalke Yep. It was an actual inversion with the vSend lock, it’s fixed.
  6. laanwj commented at 11:14 am on May 22, 2016: member

    Concept ACK

    Nit: After this mapRelay is no longer used in net at all. It could become local to main.

  7. gmaxwell commented at 10:35 pm on May 22, 2016: contributor
    @laanwj good catch with the nit, I’ve removed it from net.cpp/net.h.
  8. sipa commented at 4:22 pm on May 24, 2016: member
    utACK d9d1f2ec345b3d7ac37ce194032940b513b5e3f0
  9. theuni commented at 7:41 pm on May 24, 2016: member
    ut ACK d9d1f2ec345b3d7ac37ce194032940b513b5e3f0
  10. paveljanik commented at 8:33 pm on May 24, 2016: contributor

    @gmaxwell Can you please be more explicit in the commit message? In “This reduces the rate of not founds”, “This” means “this PR” or you mean the 15-> 16 minutes change (why not separate commit, BTW)?

    What is the logic behind 15 -> 16 anyway?

  11. gmaxwell commented at 9:27 pm on May 24, 2016: contributor
    @paveljanik “better matching far end expectations”– the far end retries on a two minute interval; 15 minutes is dead between counts– starting the counter before the transaction has been offered to anyone also makes it more likely to time out first.
  12. arowser commented at 8:43 am on May 25, 2016: contributor
    Can one of the admins verify this patch?
  13. sipa commented at 5:24 pm on May 25, 2016: member
    @gmaxwell I guess that can use some comment in the code?
  14. gmaxwell commented at 11:25 am on May 28, 2016: contributor
    I changed it back to 15 minutes, – I think the time there should be adjusted but it can be done in another pull that reworks the mapaskfor handling a bit.
  15. Defer inserting into maprelay until just before relaying.
    This reduces the rate of not founds by better matching the far
     end expectations, it also improves privacy by removing the
     ability to use getdata to probe for a node having a txn before
     it has been relayed.
    4d8993b346
  16. gmaxwell commented at 3:46 pm on May 31, 2016: contributor
    Rebased.
  17. sipa commented at 5:34 pm on May 31, 2016: member
    Lightly tested ACK. Setup: two mainnet full nodes with this patch (A publicly reachable, B -connect’ed to A) and a lightweight node C (connected to the public network). Tested block synchronization/relay of B from A, relay of transactions to from A to B, relay of newly created transactions by B and C through A. Nothing unusual.
  18. sipa merged this on Jun 1, 2016
  19. sipa closed this on Jun 1, 2016

  20. sipa referenced this in commit 01d8359983 on Jun 1, 2016
  21. codablock referenced this in commit cfe6493630 on Sep 16, 2017
  22. codablock referenced this in commit 005111b608 on Sep 19, 2017
  23. codablock referenced this in commit 51fa05ac33 on Dec 22, 2017
  24. andvgal referenced this in commit 9be6b85a52 on Jan 6, 2019
  25. zkbot referenced this in commit 1d7ed06174 on Aug 13, 2021
  26. zkbot referenced this in commit 56b5f95897 on Aug 17, 2021
  27. MarcoFalke 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: 2024-07-03 19:12 UTC

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