|
8 | 8 | from six.moves import queue, xmlrpc_client |
9 | 9 |
|
10 | 10 | from pybitmessage import protocol |
11 | | -from pybitmessage.defaults import ( |
12 | | - networkDefaultProofOfWorkNonceTrialsPerByte, |
13 | | - networkDefaultPayloadLengthExtraBytes) |
| 11 | +from pybitmessage.highlevelcrypto import calculateInventoryHash |
14 | 12 |
|
15 | 13 | from .partial import TestPartialRun |
16 | 14 | from .samples import sample_statusbar_msg, sample_object_data |
@@ -80,12 +78,14 @@ def test_disseminate_preencrypted(self): |
80 | 78 | from inventory import Inventory |
81 | 79 |
|
82 | 80 | proofofwork.init() |
83 | | - update_object = pack( |
| 81 | + self.assertEqual( |
| 82 | + unhexlify(self.api.disseminatePreparedObject( |
| 83 | + hexlify(sample_object_data).decode())), |
| 84 | + calculateInventoryHash(sample_object_data)) |
| 85 | + update_object = b'\x00' * 8 + pack( |
84 | 86 | '>Q', int(time.time() + 7200)) + sample_object_data[16:] |
85 | 87 | invhash = unhexlify(self.api.disseminatePreEncryptedMsg( |
86 | | - hexlify(update_object).decode(), |
87 | | - networkDefaultProofOfWorkNonceTrialsPerByte, |
88 | | - networkDefaultPayloadLengthExtraBytes |
| 88 | + hexlify(update_object).decode() |
89 | 89 | )) |
90 | 90 | obj_type, obj_stream, obj_data = Inventory()[invhash][:3] |
91 | 91 | self.assertEqual(obj_type, 42) |
|
0 commit comments