MCPcopy
hub / github.com/jimmysong/programmingbitcoin / handshake

Method handshake

code-ch13/network.py:361–369  ·  view source on GitHub ↗

Do a handshake with the other node. Handshake is sending a version message and getting a verack back.

(self)

Source from the content-addressed store, hash-verified

359 self.stream = self.socket.makefile('rb', None)
360
361 def handshake(self):
362 '''Do a handshake with the other node.
363 Handshake is sending a version message and getting a verack back.'''
364 # create a version message
365 version = VersionMessage()
366 # send the command
367 self.send(version)
368 # wait for a verack message
369 self.wait_for(VerAckMessage)
370
371 def send(self, message):
372 '''Send a message to the connected node'''

Callers 1

test_handshakeMethod · 0.95

Calls 3

sendMethod · 0.95
wait_forMethod · 0.95
VersionMessageClass · 0.70

Tested by 1

test_handshakeMethod · 0.76