Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions nemesis-generator/generator/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ def attach_signature(payload, signature):
writer.write_bytes(payload[:ENTITY_HEADER_SIZE])
writer.write_int(Signature.SIZE, 4)
writer.write_bytes(signature.bytes)

writer.write_bytes(payload[ENTITY_HEADER_SIZE:])
return writer.buffer

Expand All @@ -49,6 +48,8 @@ def __init__(self, input_file):
self.generation_hash = Hash256(nemesis_config['generation_hash'])
self.accounts = nemesis_config['accounts']

self.previous_block_hash = Hash256.zero()

self.unsigned_transaction_payloads = []
self.signed_transaction_payloads = []
self.signed_block_header = None
Expand Down Expand Up @@ -97,18 +98,18 @@ def prepare_block(self):
writer.write_int(0xFFFFFFFF, 4) # type
self._write_entity_header(writer)

writer.write_int(Hash256.SIZE + 4, 4)
writer.write_int(Hash256.SIZE + 4, 4) # needed to deserialize the previous block hash object
writer.write_int(Hash256.SIZE, 4)
writer.write_bytes(self.generation_hash.bytes)
writer.write_bytes(self.previous_block_hash.bytes)

writer.write_int(1, 8) # height

writer.write_int(len(self.unsigned_transaction_payloads), 4) # transactions count
writer.write_int(len(self.signed_transaction_payloads), 4) # transactions count

unsigned_block_header = writer.buffer[:]

for unsigned_transaction_payload in self.unsigned_transaction_payloads:
writer.write_bytes(unsigned_transaction_payload)
for signed_transaction_payload in self.signed_transaction_payloads:
writer.write_bytes(signed_transaction_payload)

unsigned_block = writer.buffer
signature = self.signer_key_pair.sign(unsigned_block)
Expand Down
4 changes: 2 additions & 2 deletions nemesis-generator/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
PyYAML==6.0
symbol-sdk-python==3.0.7
PyYAML==6.0.2
symbol-sdk-python==3.2.3
zenlog==1.1