From a75eec9ad15da572f9f57c9f2e1d36a01302ab2f Mon Sep 17 00:00:00 2001 From: diminator Date: Tue, 10 May 2016 17:18:49 +0200 Subject: [PATCH] abstractmethod cleanup docs update --- bigchaindb/consensus.py | 16 ++++++++-------- bigchaindb/core.py | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/bigchaindb/consensus.py b/bigchaindb/consensus.py index 030cc289..62131eab 100644 --- a/bigchaindb/consensus.py +++ b/bigchaindb/consensus.py @@ -15,6 +15,7 @@ class AbstractConsensusRules(metaclass=ABCMeta): All methods listed below must be implemented. """ + @staticmethod @abstractmethod def validate_transaction(bigchain, transaction): """Validate a transaction. @@ -31,8 +32,8 @@ class AbstractConsensusRules(metaclass=ABCMeta): Descriptive exceptions indicating the reason the transaction failed. See the `exceptions` module for bigchain-native error classes. """ - raise NotImplementedError + @staticmethod @abstractmethod def validate_block(bigchain, block): """Validate a block. @@ -49,8 +50,8 @@ class AbstractConsensusRules(metaclass=ABCMeta): Descriptive exceptions indicating the reason the block failed. See the `exceptions` module for bigchain-native error classes. """ - raise NotImplementedError + @staticmethod @abstractmethod def create_transaction(*args, **kwargs): """Create a new transaction. @@ -61,8 +62,8 @@ class AbstractConsensusRules(metaclass=ABCMeta): Returns: dict: newly constructed transaction. """ - raise NotImplementedError + @staticmethod @abstractmethod def sign_transaction(transaction, *args, **kwargs): """Sign a transaction. @@ -74,20 +75,19 @@ class AbstractConsensusRules(metaclass=ABCMeta): Returns: dict: transaction with any signatures applied. """ - raise NotImplementedError + @staticmethod @abstractmethod def validate_fulfillments(signed_transaction): - """Verify the signature of a transaction. + """Validate the fulfillments of a transaction. Args: signed_transaction (dict): signed transaction to verify Returns: - bool: True if the transaction's required signature data is present + bool: True if the transaction's required fulfillments are present and correct, False otherwise. """ - raise NotImplementedError class BaseConsensusRules(AbstractConsensusRules): @@ -217,7 +217,7 @@ class BaseConsensusRules(AbstractConsensusRules): @staticmethod def validate_fulfillments(signed_transaction): - """Verify the signature of a transaction. + """Validate the fulfillments of a transaction. Refer to the documentation of ``bigchaindb.util.validate_fulfillments`` """ diff --git a/bigchaindb/core.py b/bigchaindb/core.py index b1f33c63..329c1c54 100644 --- a/bigchaindb/core.py +++ b/bigchaindb/core.py @@ -87,12 +87,12 @@ class Bigchain(object): return self.consensus.sign_transaction(transaction, *args, **kwargs) def validate_fulfillments(self, signed_transaction, *args, **kwargs): - """Verify the fulfillment(s) of a transaction. + """Validate the fulfillment(s) of a transaction. Refer to the documentation of your consensus plugin. Returns: - bool: True if the transaction's required fulfillments is present + bool: True if the transaction's required fulfillments are present and correct, False otherwise. """