Skip to content

Conversation

jnewbery
Copy link
Contributor

@jnewbery jnewbery commented Feb 7, 2017

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 #9707

@TheBlueMatt
Copy link
Contributor

Looks awesome, but given the potential for error, why not go ahead and remove assert_raises() and conver thsoe into _message or _jsonrpc now?

Calls function `fun` with arguments `args` and `kwds`. Catches a JSONRPCException
and verifies that the error code and message are as expected. Throws AssertionError if
no JSONRPCException was returned or if the error code/message are not as expected.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EOL whitespace here and the line before it

@jnewbery
Copy link
Contributor Author

jnewbery commented Feb 8, 2017

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

@jnewbery jnewbery mentioned this pull request Feb 8, 2017
@jnewbery
Copy link
Contributor Author

jnewbery commented Feb 8, 2017

I miscounted - there are many cases of assert_raises() and assert_raises_message() being used. I'll remove them in a future commit.

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.
@jnewbery jnewbery force-pushed the fixsetbanerrormessages branch from e6cfd6e to 3295cde Compare February 10, 2017 18:32
@jnewbery
Copy link
Contributor Author

#9707 has now been merged, so this PR contains only the commit to be reviewed.

@jnewbery
Copy link
Contributor Author

Closing in favour of #9853.

@jnewbery jnewbery closed this Feb 24, 2017
@jnewbery jnewbery deleted the fixsetbanerrormessages branch February 24, 2017 16:29
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants