-
Notifications
You must be signed in to change notification settings - Fork 36.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New RPC command disconnectnode #6271
New RPC command disconnectnode #6271
Conversation
string strNode = params[0].get_str(); | ||
|
||
CNode* pNode = FindNode(strNode.c_str()); | ||
if (pNode != NULL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should raise an error when the node is not found. e.g.
if (pNode == NULL)
throw JSONRPCError(RPC_NOT_FOUND, "Node not found in connected nodes");
This makes it possible to see if an operation actually happened.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 @laanwj
I would also remove the 'strNode' round trip and directly add params[0].get_str() within FindNode()
utACK |
Tested ACK. |
@jonasschelli Just to avoid git confusion, you're asking me to add a source in git for your branch, merge the changes into mine and push it back? That's ok, I won't see my dev machine untli Monday though. |
@Alex-van-der-Peet yes, except you should use |
@Alex-van-der-Peet: right. You need to add my remote |
also includes some whitespace fixes
conn = httplib.HTTPConnection(urlNode2.hostname, urlNode2.port) | ||
conn.connect() | ||
conn.request('POST', '/', '{"method": "getbestblockhash"}', headers) | ||
out1 = conn.getresponse().read(); | ||
assert_equal('"error":null' in out1, True) | ||
assert_equal(conn.sock!=None, True) #connection must be closed because bitcoind should use keep-alive by default | ||
|
||
|
||
########################### |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jonasschnelli
I don't see the connection to add these tests in httpbasics.py
(even renaming it). Let's add a seperate test script for (upcoming) RPC node disconnect/ban/etc handling?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was trying to save some precious test time because another test will at least add another chain init and maybe mining of 100blocks on the top.
But right. A separate test could make sense if we look what else could get in there. Will do so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Saving time is not worth it at the expense of sanity :)
Maybe the chain init can be avoided for tests like this that don't need a chain?
In any case - httpbasics will become more extensive when we switch HTTP servers, so keeping the just-HTTP tests in a script of their own makes sense.
@jonasschnelli To make it easier for our new contributor I'm going to go ahead and merge this without the tests, we can add those in a separate pull (or as part of #6158, even better) |
60dbe73 New RPC command disconnectnode (Alex van der Peet)
Merged via 754aae5 |
Bitcoin 0.12 RPC PRs 1 Cherry-picked from the following upstream PRs: - bitcoin/bitcoin#6266 - bitcoin/bitcoin#6257 - bitcoin/bitcoin#6271 - bitcoin/bitcoin#6158 - bitcoin/bitcoin#6307 - bitcoin/bitcoin#6290 - bitcoin/bitcoin#6262 - bitcoin/bitcoin#6088 - bitcoin/bitcoin#6339 - bitcoin/bitcoin#6299 (partial, remainder in #2099) - bitcoin/bitcoin#6350 - bitcoin/bitcoin#6247 - bitcoin/bitcoin#6362 - bitcoin/bitcoin#5486 - bitcoin/bitcoin#6417 - bitcoin/bitcoin#6398 (partial, remainder was included in #1950) - bitcoin/bitcoin#6444 - bitcoin/bitcoin#6456 (partial, remainder was included in #2082) - bitcoin/bitcoin#6380 - bitcoin/bitcoin#6970 Part of #2074.
Original issue #2729 was implemented in pull request #6259. Based on the discussion there, this pull request adds a new RPC command disconnectnode. Tested on Ubuntu 14.04 with bitcoin-cli, works.