mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
abstractmethod cleanup
docs update
This commit is contained in:
parent
ca34b58629
commit
a75eec9ad1
@ -15,6 +15,7 @@ class AbstractConsensusRules(metaclass=ABCMeta):
|
|||||||
All methods listed below must be implemented.
|
All methods listed below must be implemented.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def validate_transaction(bigchain, transaction):
|
def validate_transaction(bigchain, transaction):
|
||||||
"""Validate a transaction.
|
"""Validate a transaction.
|
||||||
@ -31,8 +32,8 @@ class AbstractConsensusRules(metaclass=ABCMeta):
|
|||||||
Descriptive exceptions indicating the reason the transaction failed.
|
Descriptive exceptions indicating the reason the transaction failed.
|
||||||
See the `exceptions` module for bigchain-native error classes.
|
See the `exceptions` module for bigchain-native error classes.
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def validate_block(bigchain, block):
|
def validate_block(bigchain, block):
|
||||||
"""Validate a block.
|
"""Validate a block.
|
||||||
@ -49,8 +50,8 @@ class AbstractConsensusRules(metaclass=ABCMeta):
|
|||||||
Descriptive exceptions indicating the reason the block failed.
|
Descriptive exceptions indicating the reason the block failed.
|
||||||
See the `exceptions` module for bigchain-native error classes.
|
See the `exceptions` module for bigchain-native error classes.
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def create_transaction(*args, **kwargs):
|
def create_transaction(*args, **kwargs):
|
||||||
"""Create a new transaction.
|
"""Create a new transaction.
|
||||||
@ -61,8 +62,8 @@ class AbstractConsensusRules(metaclass=ABCMeta):
|
|||||||
Returns:
|
Returns:
|
||||||
dict: newly constructed transaction.
|
dict: newly constructed transaction.
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def sign_transaction(transaction, *args, **kwargs):
|
def sign_transaction(transaction, *args, **kwargs):
|
||||||
"""Sign a transaction.
|
"""Sign a transaction.
|
||||||
@ -74,20 +75,19 @@ class AbstractConsensusRules(metaclass=ABCMeta):
|
|||||||
Returns:
|
Returns:
|
||||||
dict: transaction with any signatures applied.
|
dict: transaction with any signatures applied.
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def validate_fulfillments(signed_transaction):
|
def validate_fulfillments(signed_transaction):
|
||||||
"""Verify the signature of a transaction.
|
"""Validate the fulfillments of a transaction.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
signed_transaction (dict): signed transaction to verify
|
signed_transaction (dict): signed transaction to verify
|
||||||
|
|
||||||
Returns:
|
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.
|
and correct, False otherwise.
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
|
||||||
|
|
||||||
|
|
||||||
class BaseConsensusRules(AbstractConsensusRules):
|
class BaseConsensusRules(AbstractConsensusRules):
|
||||||
@ -217,7 +217,7 @@ class BaseConsensusRules(AbstractConsensusRules):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def validate_fulfillments(signed_transaction):
|
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``
|
Refer to the documentation of ``bigchaindb.util.validate_fulfillments``
|
||||||
"""
|
"""
|
||||||
|
@ -87,12 +87,12 @@ class Bigchain(object):
|
|||||||
return self.consensus.sign_transaction(transaction, *args, **kwargs)
|
return self.consensus.sign_transaction(transaction, *args, **kwargs)
|
||||||
|
|
||||||
def validate_fulfillments(self, signed_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.
|
Refer to the documentation of your consensus plugin.
|
||||||
|
|
||||||
Returns:
|
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.
|
and correct, False otherwise.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user