Fix error causes and messages in rpc/net.cpp #9713

pull jnewbery wants to merge 1 commits into bitcoin:master from jnewbery:fixsetbanerrormessages changing 2 files +8 −10
  1. jnewbery commented at 6:30 pm on February 7, 2017: member

    There are a couple of errors in setban() which return incorrect or misleading errors. This commit fixes those and updates nodehandling.py to test that the correct error codes and messages are being returned.

    Also add a testcase for trying to setban on an invalid subnet.

    This PR builds on top of https://github.com/bitcoin/bitcoin/pull/9707

  2. TheBlueMatt commented at 10:56 pm on February 7, 2017: member
    Looks awesome, but given the potential for error, why not go ahead and remove assert_raises() and conver thsoe into _message or _jsonrpc now?
  3. in qa/rpc-tests/test_framework/util.py: in e6cfd6e0c5 outdated
    556+    """Run an RPC and verify that a specific JSONRPC exception code and message is raised.
    557+
    558+    Calls function `fun` with arguments `args` and `kwds`. Catches a JSONRPCException
    559+    and verifies that the error code and message are as expected. Throws AssertionError if 
    560+    no JSONRPCException was returned or if the error code/message are not as expected.
    561+    
    


    TheBlueMatt commented at 10:57 pm on February 7, 2017:
    EOL whitespace here and the line before it
  4. fanquake added the label RPC/REST/ZMQ on Feb 8, 2017
  5. jnewbery commented at 2:26 pm on February 8, 2017: member

    Thanks for the comments @TheBlueMatt . This PR actually contains two commits from master - the first is #9707 and the second is the commit for this PR (fixing error causes/messages in net.cpp). Looks like you’ve reviewed both in this PR.

    I was going to look at removing assert_raises() and assert_raises_message() in a future PR, but it looks like there’s actually only two cases of them being used (in p2p-segwit.py and signrawtransactions.py) so I’ll go ahead and add that to #9707

  6. jnewbery commented at 6:18 pm on February 8, 2017: member
    I miscounted - there are many cases of assert_raises() and assert_raises_message() being used. I’ll remove them in a future commit.
  7. Fix error causes and messages in rpc/net.cpp
    There are a couple of errors in `setban()` which return incorrect or
    misleading errors. This commit fixes those and updates nodehandling.py
    to test that the correct error codes and messages are being returned.
    
    Also add a testcase for trying to setban on an invalid subnet.
    3295cded33
  8. jnewbery force-pushed on Feb 10, 2017
  9. jnewbery commented at 6:33 pm on February 10, 2017: member
    #9707 has now been merged, so this PR contains only the commit to be reviewed.
  10. jnewbery commented at 4:29 pm on February 24, 2017: member
    Closing in favour of #9853.
  11. jnewbery closed this on Feb 24, 2017

  12. jnewbery deleted the branch on Feb 24, 2017
  13. 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: 2024-11-17 18:12 UTC

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