Resolve discrepancy with NotEnoughNodes exceptions; preserve discription of multi inheretance

pull/447/head
Kieran Prasch 2018-09-22 21:03:09 -07:00
parent 51a3d0b1c4
commit 5e10e48f54
3 changed files with 8 additions and 8 deletions

View File

@ -270,6 +270,7 @@ class PolicyAuthor(NucypherTokenActor):
if policy_agent is None:
# From defaults
self.token_agent = NucypherTokenAgent()
self.miner_agent = MinerAgent(token_agent=self.token_agent)
self.policy_agent = PolicyAgent(miner_agent=self.miner_agent)
else:

View File

@ -21,7 +21,6 @@ from typing import Union, List
from umbral.keys import UmbralPublicKey
from umbral.signing import Signature
from nucypher.blockchain.eth.agents import MinerAgent
from nucypher.crypto.api import encrypt_and_sign
from nucypher.crypto.kits import UmbralMessageKit
from nucypher.crypto.powers import CryptoPower, SigningPower, EncryptingPower, NoSigningPower, CryptoPowerUp
@ -321,12 +320,6 @@ class Character(Learner):
from nucypher.network.protocols import SuspiciousActivity # Ship this exception with every Character.
class NotEnoughUrsulas(MinerAgent.NotEnoughMiners):
"""
All Characters depend on knowing about enough Ursulas to perform their role.
This exception is raised when a piece of logic can't proceed without more Ursulas.
"""
class InvalidSignature(Exception):
"""
Raised when a signature doesn't pass validation/verification.

View File

@ -242,7 +242,7 @@ class Bob(Character):
if not self.known_nodes and not self._learning_task.running:
# Quick sanity check - if we don't know of *any* Ursulas, and we have no
# plans to learn about any more, than this function will surely fail.
raise self.NotEnoughUrsulas
raise Ursula.NotEnoughUrsulas
treasure_map = self.get_treasure_map_from_known_ursulas(self.network_middleware,
map_id)
@ -387,6 +387,12 @@ class Ursula(Character, VerifiableNode, Miner):
# TLSHostingPower still can enjoy default status, but on a different class
_default_crypto_powerups = [SigningPower, EncryptingPower]
class NotEnoughUrsulas(Learner.NotEnoughTeachers, MinerAgent.NotEnoughMiners):
"""
All Characters depend on knowing about enough Ursulas to perform their role.
This exception is raised when a piece of logic can't proceed without more Ursulas.
"""
class NotFound(Exception):
pass