Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def to_bytes(self):
data: list = [
self._VERSION,
self.reward_prep
]
return MsgPackForDB.dumps(data)
self._irep,
self._irep_block_height,
self._last_generate_block_height,
self._block_height,
self._tx_index,
self._total_blocks,
self._validated_blocks,
]
if version >= 1:
data.extend((self.penalty.value, self._unvalidated_sequence_blocks))
if version >= 2:
data.append(self._node_address)
return MsgPackForDB.dumps(data)
def to_bytes(self) -> bytes:
data = [
self._VERSION,
self._block_height,
self._block_hash,
self._term_start_block_height,
self._last_block.to_bytes(Revision.IISS.value)
]
return MsgPackForDB.dumps(data)
def to_bytes(self) -> bytes:
"""Convert Account of Stake object to bytes
:return: data including information of AccountOfDelegation object
"""
data = [self._VERSION, self.delegated_amount]
delegations: list = []
for address, value in self._delegations:
delegations.append(address)
delegations.append(value)
data.append(delegations)
return MsgPackForDB.dumps(data)
:return: data including information of PrepCandidate object
"""
data = [
self._VERSION,
self.name,
self.email,
self.website,
self.json,
self.ip,
self.block_height,
self.tx_index,
self.gv.encode()
]
return MsgPackForDB.dumps(data)
def to_bytes(self) -> bytes:
"""Convert Account of Stake object to bytes
:return: data including information of StakePart object
"""
assert self.is_set(BasePartState.COMPLETE)
data = [self._VERSION, self._stake, self._unstake, self._unstake_block_height]
return MsgPackForDB.dumps(data)
def to_bytes(self):
data: list = [
self._VERSION,
self.reward_min,
self.reward_max,
self.reward_point,
self.lock_min,
self.lock_max
]
return MsgPackForDB.dumps(data)
def _put_version_and_revision(self, revision: int):
version: int = get_rc_version(revision)
version_and_revision: bytes = MsgPackForDB.dumps([version, revision])
self._db.put(self.KEY_FOR_VERSION_AND_REVISION, version_and_revision)