Janitorial stuff

pull/1171/head
David Núñez 2019-07-30 13:37:08 +02:00
parent 3a6bfa23a2
commit 9e0552d7ec
3 changed files with 10 additions and 4 deletions

View File

@ -154,6 +154,9 @@ class BlockchainPolicy(Policy):
value=rate*duration, # TODO Check the math/types here value=rate*duration, # TODO Check the math/types here
lock_periods=duration, lock_periods=duration,
expiration=end_block) expiration=end_block)
# TODO: #1173 - This method is unused and seems broken.
# I think that something here will fail as the arrangement ID is not
# passed above to the constructor, so a new random ID will be created.
arrangement.is_published = True arrangement.is_published = True
return arrangement return arrangement

View File

@ -368,7 +368,7 @@ def make_rest_app(
do_store = treasure_map.public_id() == treasure_map_id do_store = treasure_map.public_id() == treasure_map_id
if do_store: if do_store:
log.info("{} storing TreasureMap {}".format(this_node.stamp, treasure_map_id)) log.info("{} storing TreasureMap {}".format(this_node, treasure_map_id))
# TODO 341 - what if we already have this TreasureMap? # TODO 341 - what if we already have this TreasureMap?
treasure_map_index = bytes.fromhex(treasure_map_id) treasure_map_index = bytes.fromhex(treasure_map_id)

View File

@ -20,7 +20,6 @@ from collections import OrderedDict
import maya import maya
import msgpack import msgpack
import uuid
from bytestring_splitter import BytestringSplitter, VariableLengthBytestring from bytestring_splitter import BytestringSplitter, VariableLengthBytestring
from constant_sorrow.constants import UNKNOWN_KFRAG, NO_DECRYPTION_PERFORMED, NOT_SIGNED from constant_sorrow.constants import UNKNOWN_KFRAG, NO_DECRYPTION_PERFORMED, NOT_SIGNED
from cryptography.hazmat.backends.openssl import backend from cryptography.hazmat.backends.openssl import backend
@ -76,10 +75,14 @@ class Arrangement:
Other params are hopefully self-evident. Other params are hopefully self-evident.
""" """
self.id = arrangement_id or secure_random(self.ID_LENGTH) if arrangement_id:
if len(arrangement_id) != self.ID_LENGTH:
raise ValueError(f"Arrangement ID must be of length {self.ID_LENGTH}.")
self.id = arrangement_id
else:
self.id = secure_random(self.ID_LENGTH)
self.expiration = expiration self.expiration = expiration
self.alice = alice self.alice = alice
self.uuid = uuid.uuid4()
self.value = value self.value = value
""" """