bitpay / bitcore-p2p

Interface to the bitcoin P2P network for bitcore
MIT License
80 stars 276 forks source link

Add 'peerconnect' event from Pool #38

Closed throughnothing closed 9 years ago

throughnothing commented 9 years ago

This could be useful to some consumers. I'm using it to detect nodes that are connected, but slow to respond with their verack commands, to disconnect these slow nodes and get different nodes in my pool.

braydonf commented 9 years ago

The connect event should likely have a separate test, as the "new addrs" test is only testing for handling of "addr" messages.

throughnothing commented 9 years ago

@braydonf yup, was already working on a better test, that will test peerready, peerdisconnect, and peerconnect messages (all of which weren't really tested). Just pushed.

coveralls commented 9 years ago

Coverage Status

Coverage increased (+0.03%) to 91.95% when pulling 3ed6931c67ac6a7288695d83ce5907e18f0d74e0 on throughnothing:peerconnect-event into e19734593e1df6c4edc6d73603666eaaf9a9ba98 on bitpay:master.

braydonf commented 9 years ago

Interesting, I thought there may have been a test for disconnect, but it doesn't look like it. It should test to make sure that the peer has been removed from _connectedPeers, but that can be done in another PR.

throughnothing commented 9 years ago

Good catch, updated.

coveralls commented 9 years ago

Coverage Status

Coverage increased (+0.03%) to 91.95% when pulling e0b58e25d673ed8207ddf1af1a4919b762e7979f on throughnothing:peerconnect-event into e19734593e1df6c4edc6d73603666eaaf9a9ba98 on bitpay:master.

braydonf commented 9 years ago

LGTM

maraoz commented 9 years ago

great contribution, thanks @throughnothing !