Simplify ProcessGetBlockData execution by removing send flag #13250

pull pstratem wants to merge 2 commits into bitcoin:master from pstratem:2018-05-16-processgetblockdata changing 3 files +46 −11
  1. pstratem commented at 10:50 pm on May 16, 2018: contributor
    Setting the send flag to false can be replaced by simply returning.
  2. MarcoFalke added the label P2P on May 16, 2018
  3. pstratem commented at 11:12 pm on May 16, 2018: contributor
    the send flag effectively exits the function whenever it’s set to false, this simply actually returns
  4. MarcoFalke added the label Refactoring on May 16, 2018
  5. sipa commented at 11:14 pm on May 16, 2018: member
    Yes, I can read the code. But can you actually put that in the PR description? The description goes into the merge commit for example, and is helpful for people investigating the history of code.
  6. pstratem force-pushed on May 16, 2018
  7. pstratem renamed this:
    Simplify ProcessGetBlockData execution
    Simplify ProcessGetBlockData execution by removing send flag
    on May 16, 2018
  8. in src/net_processing.cpp:1110 in 311af6cfc6 outdated
    1107@@ -1109,35 +1108,35 @@ void static ProcessGetBlockData(CNode* pfrom, const Consensus::Params& consensus
    1108     LOCK(cs_main);
    1109     const CBlockIndex* pindex = LookupBlockIndex(inv.hash);
    1110     if (pindex) {
    


    skeees commented at 11:55 pm on May 16, 2018:
    you should return if pindex is not defined

    pstratem commented at 1:00 am on May 17, 2018:
    indeed good catch
  9. pstratem force-pushed on May 17, 2018
  10. Simplify ProcessGetBlockData execution by removing send flag.
    Setting the send flag to false can be replaced by simply returning.
    d321740169
  11. pstratem force-pushed on May 17, 2018
  12. pstratem force-pushed on May 17, 2018
  13. fanquake commented at 2:05 am on May 17, 2018: member

    Travis:

    011.84s$ if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then contrib/devtools/lint-all.sh; fi
    1./test/functional/p2p_invalid_getdata.py:31:1: W293 blank line contains whitespace
    2^---- failure generated from contrib/devtools/lint-python.sh
    
  14. pstratem force-pushed on May 17, 2018
  15. in test/functional/p2p_invalid_getdata.py:2 in 261026b645 outdated
    0@@ -0,0 +1,36 @@
    1+#!/usr/bin/env python3
    2+# Copyright (c) 2016-2017 The Bitcoin Core developers
    


    Empact commented at 2:17 am on May 17, 2018:
    2018
  16. in test/functional/p2p_invalid_getdata.py:20 in 261026b645 outdated
    15+        super().__init__()
    16+
    17+class InvalidGetDataTest(BitcoinTestFramework):
    18+    def set_test_params(self):
    19+        self.setup_clean_chain = True
    20+        self.num_nodes = 3
    


    Empact commented at 2:18 am on May 17, 2018:
    Looks like you’re using 2 nodes below, index 0 and 1, is that right?
  17. pstratem force-pushed on May 19, 2018
  18. pstratem force-pushed on May 19, 2018
  19. pstratem force-pushed on May 19, 2018
  20. Functional test of receipt of invalid getdata request. dd5ee7fd3a
  21. DrahtBot commented at 11:22 am on July 14, 2018: member
  22. DrahtBot added the label Needs rebase on Jul 14, 2018
  23. in test/functional/p2p_invalid_getdata.py:26 in dd5ee7fd3a
    21+
    22+    def run_test(self):
    23+        # Setup the p2p connections and start up the network thread.
    24+        self.test_node = self.nodes[0].add_p2p_connection(TestP2PConn())
    25+
    26+        network_thread_start()
    


    MarcoFalke commented at 11:50 am on July 14, 2018:
    nit: The thread is always running on master. Remove this line.
  24. fanquake commented at 2:29 pm on July 15, 2018: member
    I’ve rebased and fixed the nit in #13670.
  25. fanquake closed this on Jul 15, 2018

  26. laanwj removed the label Needs rebase on Oct 24, 2019
  27. MarcoFalke locked this on Dec 16, 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-11-17 18:12 UTC

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