Ejemplo n.º 1
0
 def create(cls, hash: str, merkle_root: str, merkle_leaves: str,
            prev_block_hash: str, timestamp: int, masternode_signature: str,
            masternode_vk: str, block_contender: BlockContender):
     struct = blockdata_capnp.BlockMetaData.new_message()
     struct.hash = hash
     struct.merkleRoot = merkle_root
     struct.merkleLeaves = merkle_leaves
     struct.prevBlockHash = prev_block_hash
     struct.timestamp = timestamp
     struct.masternodeSignature = masternode_signature
     struct.masternodeVk = masternode_vk
     assert type(block_contender) == BlockContender, 'Not a block contender'
     struct.blockContender = block_contender.serialize()
     return cls.from_data(struct)
Ejemplo n.º 2
0
def _serialize_contender(block_contender: BlockContender) -> str:
    hex_str = block_contender.serialize().hex()
    return hex_str