2020-04-06 11:52:18 +02:00
|
|
|
# Copyright © 2020 Interplanetary Database Association e.V.,
|
|
|
|
# BigchainDB and IPDB software contributors.
|
2018-08-16 12:31:32 +02:00
|
|
|
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
|
|
|
# Code is Apache-2.0 and docs are CC-BY-4.0
|
2016-03-09 03:32:25 +01:00
|
|
|
|
|
|
|
|
2018-09-20 17:17:33 +02:00
|
|
|
class BaseValidationRules():
|
|
|
|
"""Base validation rules for BigchainDB.
|
2017-01-24 10:12:16 +01:00
|
|
|
|
2018-09-20 17:17:33 +02:00
|
|
|
A validation plugin must expose a class inheriting from this one via an entry_point.
|
2017-01-24 10:12:16 +01:00
|
|
|
|
|
|
|
All methods listed below must be implemented.
|
2016-03-09 03:24:21 +01:00
|
|
|
"""
|
2017-11-30 15:04:14 +01:00
|
|
|
|
2016-03-09 03:33:31 +01:00
|
|
|
@staticmethod
|
2018-09-20 17:17:33 +02:00
|
|
|
def validate_transaction(bigchaindb, transaction):
|
2016-09-29 10:29:41 +02:00
|
|
|
"""See :meth:`bigchaindb.models.Transaction.validate`
|
2017-11-30 15:04:14 +01:00
|
|
|
for documentation.
|
|
|
|
"""
|
2018-09-20 17:17:33 +02:00
|
|
|
return transaction.validate(bigchaindb)
|
2016-03-09 03:24:21 +01:00
|
|
|
|
2016-03-09 03:33:31 +01:00
|
|
|
@staticmethod
|
2018-09-20 17:17:33 +02:00
|
|
|
def validate_block(bigchaindb, block):
|
2016-09-29 10:29:41 +02:00
|
|
|
"""See :meth:`bigchaindb.models.Block.validate` for documentation."""
|
2018-09-20 17:17:33 +02:00
|
|
|
return block.validate(bigchaindb)
|