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

Method send

code-ch13/network.py:371–379  ·  view source on GitHub ↗

Send a message to the connected node

(self, message)

Source from the content-addressed store, hash-verified

369 self.wait_for(VerAckMessage)
370
371 def send(self, message):
372 '''Send a message to the connected node'''
373 # create a network envelope
374 envelope = NetworkEnvelope(
375 message.command, message.serialize(), testnet=self.testnet)
376 if self.logging:
377 print('sending: {}'.format(envelope))
378 # send the serialized envelope over the socket using sendall
379 self.socket.sendall(envelope.serialize())
380
381 def read(self):
382 '''Read a message from the socket'''

Callers 2

handshakeMethod · 0.95
wait_forMethod · 0.95

Calls 3

serializeMethod · 0.95
NetworkEnvelopeClass · 0.70
serializeMethod · 0.45

Tested by

no test coverage detected