Skip to content

Commit 7c46991

Browse files
committed
Add msg_notfound
1 parent 9b00e4b commit 7c46991

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

bitcoin/messages.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,25 @@ def msg_ser(self, f):
259259
def __repr__(self):
260260
return "msg_getdata(inv=%s)" % (repr(self.inv))
261261

262+
class msg_notfound(MsgSerializable):
263+
command = b"notfound"
264+
265+
def __init__(self, protover=PROTO_VERSION):
266+
super(msg_notfound, self).__init__(protover)
267+
self.inv = []
268+
269+
@classmethod
270+
def msg_deser(cls, f, protover=PROTO_VERSION):
271+
c = cls()
272+
c.inv = VectorSerializer.stream_deserialize(CInv, f)
273+
return c
274+
275+
def msg_ser(self, f):
276+
VectorSerializer.stream_serialize(CInv, self.inv, f)
277+
278+
def __repr__(self):
279+
return "msg_notfound(inv=%s)" % (repr(self.inv))
280+
262281

263282
class msg_getblocks(MsgSerializable):
264283
command = b"getblocks"
@@ -440,7 +459,7 @@ def __repr__(self):
440459
return "msg_mempool()"
441460

442461
msg_classes = [msg_version, msg_verack, msg_addr, msg_alert, msg_inv,
443-
msg_getdata, msg_getblocks, msg_getheaders,
462+
msg_getdata, msg_notfound, msg_getblocks, msg_getheaders,
444463
msg_headers, msg_tx, msg_block, msg_getaddr, msg_ping,
445464
msg_pong, msg_mempool]
446465

bitcoin/tests/test_messages.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313

1414
from bitcoin.messages import msg_version, msg_verack, msg_addr, msg_alert, \
1515
msg_inv, msg_getdata, msg_getblocks, msg_getheaders, msg_headers, msg_tx, \
16-
msg_block, msg_getaddr, msg_ping, msg_pong, msg_mempool, MsgSerializable
16+
msg_block, msg_getaddr, msg_ping, msg_pong, msg_mempool, MsgSerializable, \
17+
msg_notfound
1718

1819
import sys
1920
if sys.version > '3':
@@ -66,6 +67,11 @@ def test_serialization(self):
6667
super(Test_msg_getblocks, self).serialization_test(msg_getblocks)
6768

6869

70+
class Test_msg_notfound(MessageTestCase):
71+
def test_serialization(self):
72+
super(Test_msg_notfound, self).serialization_test(msg_notfound)
73+
74+
6975
class Test_msg_getheaders(MessageTestCase):
7076
def test_serialization(self):
7177
super(Test_msg_getheaders, self).serialization_test(msg_getheaders)

0 commit comments

Comments
 (0)