Skip to content

Comments

Disconnect peers which we do not receive VERACKs from within 60 sec#9715

Merged
laanwj merged 4 commits intobitcoin:masterfrom
TheBlueMatt:2017-02-disconnect-no-verack
Feb 14, 2017
Merged

Disconnect peers which we do not receive VERACKs from within 60 sec#9715
laanwj merged 4 commits intobitcoin:masterfrom
TheBlueMatt:2017-02-disconnect-no-verack

Conversation

@TheBlueMatt
Copy link
Contributor

Also adds a test, which turned out to be harder than expected because python is braindead.

@TheBlueMatt TheBlueMatt force-pushed the 2017-02-disconnect-no-verack branch from 32d849b to ead1c0c Compare February 7, 2017 22:49
@TheBlueMatt
Copy link
Contributor Author

Note that previously it was unsupported behavior, but possible to use a connection normally without ever sending a VERACK, so this might actually have some effect on others, though we had already broken their ability to function normally with some recent net changes (post 0.13).

@pstratem
Copy link
Contributor

pstratem commented Feb 8, 2017

utACK ead1c0cd17a8c696479abff58b91acc1373af179

@theuni
Copy link
Member

theuni commented Feb 8, 2017

utACK ead1c0cd17a8c696479abff58b91acc1373af179

Copy link
Contributor

@paveljanik paveljanik Feb 8, 2017

Choose a reason for hiding this comment

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

micronit: Technically speaking, this test takes at least 62 seconds, so it should be moved up a bit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@paveljanik
Copy link
Contributor

ACK ead1c0c

Copy link
Contributor

Choose a reason for hiding this comment

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

Move comment above the class itself?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@maflcko maflcko added this to the 0.14.0 milestone Feb 8, 2017
@TheBlueMatt TheBlueMatt force-pushed the 2017-02-disconnect-no-verack branch from ead1c0c to 520a033 Compare February 8, 2017 15:21
@gmaxwell
Copy link
Contributor

gmaxwell commented Feb 8, 2017

utACK

Copy link
Contributor

Choose a reason for hiding this comment

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

Should use != instead of is not to avoid relying on string interning (also for two other string comparisons below).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed, I believe.

@TheBlueMatt TheBlueMatt force-pushed the 2017-02-disconnect-no-verack branch from 520a033 to cfe2743 Compare February 8, 2017 17:08
@sipa
Copy link
Member

sipa commented Feb 8, 2017

utACK the network code, i haven't verified the test code.

Copy link
Contributor

@gmaxwell gmaxwell left a comment

Choose a reason for hiding this comment

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

ACK (haven't reviewed/tested the test code)

@laanwj
Copy link
Member

laanwj commented Feb 9, 2017

@jnewbery Can you please comment why you gave this a thumbs-down?

Copy link
Contributor

@kallewoof kallewoof left a comment

Choose a reason for hiding this comment

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

utACK

@jnewbery
Copy link
Contributor

jnewbery commented Feb 9, 2017

@laanwj - ha. 👎 is for being mean about python. I definitely ❤️ tests and 👍 people writing more of them. Who knew emojis could be so ambiguous 😛

I intend to review @TheBlueMatt's test today.

(in all seriousness, we should do whatever we can to make our qa framework less braindead and make it easier to add good, solid tests quickly)

Copy link
Contributor

@jnewbery jnewbery left a comment

Choose a reason for hiding this comment

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

Test case looks good. I have a couple of style suggestions, which I've implemented here: https://github.com/jnewbery/bitcoin/commits/pr9715 . Feel free to squash that code into your commit if you agree

from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from time import sleep

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should try to use a consistent PEP8 convention for frontmatter:

  • shebang
  • copyright notice
  • module docstring
  • standard library imports
  • project imports

(see #9577). Can I convince you to do the same here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK. Done, I think?

}

def __init__(self, dstaddr, dstport, rpc, callback, net="regtest", services=NODE_NETWORK):
def __init__(self, dstaddr, dstport, rpc, callback, net="regtest", services=NODE_NETWORK, send_version=True):
Copy link
Contributor

Choose a reason for hiding this comment

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

In my experience, test class and function interfaces often accumulate a lot of cruft as people add special-cases for individual test cases. It'd be nice if we could keep NodeConn's init() interface clean.

Would the following be a more elegant way to achieve this?

  • add a send_version() method to NodeConn and move the send_version code there
  • create a child class of NodeConn in your testcase that overrides the send_version() method

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, I thought about this originlly, but hate overriding everything even more (then someone goes in and changes the function name and everything fails suddenly). Isnt this what python's named arguments is supposed to make clean?

Copy link
Contributor

Choose a reason for hiding this comment

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

Well, if you change a function name and everything fails suddenly, that's a pretty good indicator that you should change it back :)

Meh - you have a preference for named arguments, I have a slight preference for overriding the function. I'm not going to fight you on it.

But I would really like you to include the module docstring and addition comments from jnewbery@9457e23, or equivalent.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, sorry, I missed that this commit was intended for this branch...I took the docs part of that commit (thanks!).

@TheBlueMatt TheBlueMatt force-pushed the 2017-02-disconnect-no-verack branch from cfe2743 to fb140d2 Compare February 9, 2017 22:13
@TheBlueMatt TheBlueMatt force-pushed the 2017-02-disconnect-no-verack branch from fb140d2 to 66f861a Compare February 9, 2017 22:34
@jnewbery
Copy link
Contributor

jnewbery commented Feb 9, 2017

ACK test changes in 66f861a

@laanwj laanwj merged commit 66f861a into bitcoin:master Feb 14, 2017
laanwj added a commit that referenced this pull request Feb 14, 2017
…thin 60 sec

66f861a Add a test for P2P inactivity timeouts (Matt Corallo)
b436f92 qa: Expose on-connection to mininode listeners (Matt Corallo)
8aaba7a qa: mininode learns when a socket connects, not its first action (Matt Corallo)
2cbd119 Disconnect peers which we do not receive VERACKs from within 60 sec (Matt Corallo)
codablock pushed a commit to codablock/dash that referenced this pull request Jan 23, 2018
…from within 60 sec

66f861a Add a test for P2P inactivity timeouts (Matt Corallo)
b436f92 qa: Expose on-connection to mininode listeners (Matt Corallo)
8aaba7a qa: mininode learns when a socket connects, not its first action (Matt Corallo)
2cbd119 Disconnect peers which we do not receive VERACKs from within 60 sec (Matt Corallo)
andvgal pushed a commit to energicryptocurrency/gen2-energi that referenced this pull request Jan 6, 2019
…from within 60 sec

66f861a Add a test for P2P inactivity timeouts (Matt Corallo)
b436f92 qa: Expose on-connection to mininode listeners (Matt Corallo)
8aaba7a qa: mininode learns when a socket connects, not its first action (Matt Corallo)
2cbd119 Disconnect peers which we do not receive VERACKs from within 60 sec (Matt Corallo)
CryptoCentric pushed a commit to absolute-community/absolute that referenced this pull request Feb 27, 2019
@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.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.