From 5d2cb793367ca4928a014cf60211899518bcd1a6 Mon Sep 17 00:00:00 2001 From: Erik van den Brink Date: Mon, 18 Jan 2021 10:01:24 +0100 Subject: [PATCH] https://github.com/neo-project/neo/pull/1902 --- neo3/network/payloads/consensus.py | 1 + tests/network/test_payloads.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/neo3/network/payloads/consensus.py b/neo3/network/payloads/consensus.py index 295ad6b0..d9e88465 100644 --- a/neo3/network/payloads/consensus.py +++ b/neo3/network/payloads/consensus.py @@ -78,6 +78,7 @@ def __len__(self): def hash(self) -> types.UInt256: with serialization.BinaryWriter() as bw: + bw.write_uint32(settings.network.magic) self.serialize_unsigned(bw) data_to_hash = bytearray(bw._stream.getvalue()) data = hashlib.sha256(hashlib.sha256(data_to_hash).digest()).digest() diff --git a/tests/network/test_payloads.py b/tests/network/test_payloads.py index 126fbc5e..6c865bdc 100644 --- a/tests/network/test_payloads.py +++ b/tests/network/test_payloads.py @@ -352,7 +352,7 @@ def setUpClass(cls) -> None: def test_len_and_hash(self): # captured from C#, see setUpClass() for the capture code expected_len = 56 - expected_hash = types.UInt256.from_string('534233410f85a5b5201bd36f0d0e4bf4cc706d0a5392d9f8ecc4f34b89ea9060') + expected_hash = types.UInt256.from_string('44d22b68b530cfc7f1c1586e7e516368227bffd95a912413af7ea424f5605633') self.assertEqual(expected_len, len(self.payload)) self.assertEqual(expected_hash, self.payload.hash())