mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Add transaction schema validation to the server
by overriding Transaction.from_dict() in models.py
This commit is contained in:
parent
96143f7e60
commit
602dfbea06
@ -6,6 +6,7 @@ from bigchaindb.common.exceptions import (InvalidHash, InvalidSignature,
|
|||||||
AssetIdMismatch, AmountError)
|
AssetIdMismatch, AmountError)
|
||||||
from bigchaindb.common.transaction import Transaction, Asset
|
from bigchaindb.common.transaction import Transaction, Asset
|
||||||
from bigchaindb.common.util import gen_timestamp, serialize
|
from bigchaindb.common.util import gen_timestamp, serialize
|
||||||
|
from bigchaindb.common.schema import validate_transaction_schema
|
||||||
|
|
||||||
|
|
||||||
class Transaction(Transaction):
|
class Transaction(Transaction):
|
||||||
@ -113,6 +114,11 @@ class Transaction(Transaction):
|
|||||||
else:
|
else:
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls, tx_body):
|
||||||
|
validate_transaction_schema(tx_body)
|
||||||
|
return super().from_dict(tx_body)
|
||||||
|
|
||||||
|
|
||||||
class Block(object):
|
class Block(object):
|
||||||
"""Bundle a list of Transactions in a Block. Nodes vote on its validity.
|
"""Bundle a list of Transactions in a Block. Nodes vote on its validity.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user