Skip to content

Commit

Permalink
https://github.com/neo-project/neo/pull/1902
Browse files Browse the repository at this point in the history
  • Loading branch information
ixje committed Jan 18, 2021
1 parent 02cc64e commit 5d2cb79
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions neo3/network/payloads/consensus.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion tests/network/test_payloads.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand Down

0 comments on commit 5d2cb79

Please sign in to comment.