diff options
author | MarcoFalke <falke.marco@gmail.com> | 2016-04-21 17:22:36 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2016-04-21 17:23:25 +0200 |
commit | 59ad56851a342d2c62f6b38bf15002b23ab439e1 (patch) | |
tree | fcb90017374789e474f60992af94662004759154 | |
parent | 78d61aab233f36d7840cfffdb0eb395259d22ab4 (diff) | |
parent | 807fa47a1e5c9f072d7dbf549bf17f66c47dbf46 (diff) |
Merge #7912: Tests: Fix deserialization of reject messages
807fa47 Tests: Fix deserialization of reject messages (Suhas Daftuar)
-rwxr-xr-x | qa/rpc-tests/test_framework/mininode.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/qa/rpc-tests/test_framework/mininode.py b/qa/rpc-tests/test_framework/mininode.py index 5ee5b13275..af33564114 100755 --- a/qa/rpc-tests/test_framework/mininode.py +++ b/qa/rpc-tests/test_framework/mininode.py @@ -983,6 +983,7 @@ class msg_headers(object): class msg_reject(object): command = b"reject" + REJECT_MALFORMED = 1 def __init__(self): self.message = b"" @@ -994,14 +995,16 @@ class msg_reject(object): self.message = deser_string(f) self.code = struct.unpack("<B", f.read(1))[0] self.reason = deser_string(f) - if (self.message == "block" or self.message == "tx"): + if (self.code != self.REJECT_MALFORMED and + (self.message == b"block" or self.message == b"tx")): self.data = deser_uint256(f) def serialize(self): r = ser_string(self.message) r += struct.pack("<B", self.code) r += ser_string(self.reason) - if (self.message == "block" or self.message == "tx"): + if (self.code != self.REJECT_MALFORMED and + (self.message == b"block" or self.message == b"tx")): r += ser_uint256(self.data) return r |