From 1d42a797b6aa24c961401266a51fbb0096ebf2bd Mon Sep 17 00:00:00 2001 From: jMyles Date: Fri, 22 Jun 2018 18:09:11 -0700 Subject: [PATCH] publish() for Federated logic. --- nucypher/blockchain/eth/policies.py | 12 ++++++++++++ nucypher/crypto/constants.py | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/nucypher/blockchain/eth/policies.py b/nucypher/blockchain/eth/policies.py index c9d9aa265..59956ed83 100644 --- a/nucypher/blockchain/eth/policies.py +++ b/nucypher/blockchain/eth/policies.py @@ -198,3 +198,15 @@ class BlockchainPolicy(Policy): if len(accepted) < self.n: raise Exception("Selected Ursulas rejected too many arrangements") # TODO: Better exception + + def publish(self, network_middleware) -> None: + """Publish enacted arrangements.""" + + if not self._enacted_arrangements: + raise RuntimeError("There are no enacted arrangements to publish to the network.") + + while len(self._enacted_arrangements) > 0: + kfrag, arrangement = self._enacted_arrangements.popitem() + arrangement.publish() + + super().publish(network_middleware) diff --git a/nucypher/crypto/constants.py b/nucypher/crypto/constants.py index 59df28b96..e7ed20540 100644 --- a/nucypher/crypto/constants.py +++ b/nucypher/crypto/constants.py @@ -9,4 +9,4 @@ KECCAK_DIGEST_LENGTH = 32 # These lengths are specific to secp256k1 CAPSULE_LENGTH(98) PUBLIC_KEY_LENGTH(33) -PUBLIC_ADDRESS_LENGTH(42) +PUBLIC_ADDRESS_LENGTH(20)