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

Method test_serialize

code-ch13/network.py:106–114  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

104 self.assertEqual(envelope.payload, msg[24:])
105
106 def test_serialize(self):
107 msg = bytes.fromhex('f9beb4d976657261636b000000000000000000005df6e0e2')
108 stream = BytesIO(msg)
109 envelope = NetworkEnvelope.parse(stream)
110 self.assertEqual(envelope.serialize(), msg)
111 msg = bytes.fromhex('f9beb4d976657273696f6e0000000000650000005f1a69d2721101000100000000000000bc8f5e5400000000010000000000000000000000000000000000ffffc61b6409208d010000000000000000000000000000000000ffffcb0071c0208d128035cbc97953f80f2f5361746f7368693a302e392e332fcf05050001')
112 stream = BytesIO(msg)
113 envelope = NetworkEnvelope.parse(stream)
114 self.assertEqual(envelope.serialize(), msg)
115
116
117class VersionMessage:

Callers

nothing calls this directly

Calls 2

parseMethod · 0.45
serializeMethod · 0.45

Tested by

no test coverage detected