mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Problem: all blocks are valid
Solution: remove the status from transactions
This commit is contained in:
parent
a48259afb1
commit
daf4568a32
@ -1,8 +1,6 @@
|
||||
from bigchaindb.common.exceptions import (InvalidSignature, DoubleSpend,
|
||||
InputDoesNotExist,
|
||||
TransactionNotInValidBlock,
|
||||
AssetIdMismatch, AmountError,
|
||||
DuplicateTransaction)
|
||||
InputDoesNotExist, AssetIdMismatch,
|
||||
AmountError, DuplicateTransaction)
|
||||
from bigchaindb.common.transaction import Transaction
|
||||
from bigchaindb.common.utils import (validate_txn_obj, validate_key)
|
||||
from bigchaindb.common.schema import validate_transaction_schema
|
||||
@ -36,26 +34,18 @@ class Transaction(Transaction):
|
||||
input_txs = []
|
||||
for input_ in self.inputs:
|
||||
input_txid = input_.fulfills.txid
|
||||
input_tx, status = bigchain.\
|
||||
get_transaction(input_txid, include_status=True)
|
||||
input_tx = bigchain.\
|
||||
get_transaction(input_txid)
|
||||
|
||||
if input_tx is None:
|
||||
for ctxn in current_transactions:
|
||||
# assume that the status as valid for previously validated
|
||||
# transactions in current round
|
||||
if ctxn.id == input_txid:
|
||||
input_tx = ctxn
|
||||
status = 'valid'
|
||||
|
||||
if input_tx is None:
|
||||
raise InputDoesNotExist("input `{}` doesn't exist"
|
||||
.format(input_txid))
|
||||
|
||||
if status != 'valid':
|
||||
raise TransactionNotInValidBlock(
|
||||
'input `{}` does not exist in a valid block'.format(
|
||||
input_txid))
|
||||
|
||||
spent = bigchain.get_spent(input_txid, input_.fulfills.output,
|
||||
current_transactions)
|
||||
if spent and spent.id != self.id:
|
||||
|
||||
@ -28,7 +28,7 @@ class TransactionApi(Resource):
|
||||
pool = current_app.config['bigchain_pool']
|
||||
|
||||
with pool() as bigchain:
|
||||
tx, status = bigchain.get_transaction(tx_id, include_status=True)
|
||||
tx = bigchain.get_transaction(tx_id)
|
||||
|
||||
if not tx:
|
||||
return make_error(404)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user