mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Simplify Transaction.to_inputs method
This commit is contained in:
parent
29832f9a9b
commit
6ef18fbbae
@ -786,20 +786,14 @@ class Transaction(object):
|
|||||||
:obj:`list` of :class:`~bigchaindb.common.transaction.
|
:obj:`list` of :class:`~bigchaindb.common.transaction.
|
||||||
Fulfillment`
|
Fulfillment`
|
||||||
"""
|
"""
|
||||||
inputs = []
|
# NOTE: If no condition indices are passed, we just assume to
|
||||||
if condition_indices is None or len(condition_indices) == 0:
|
# take all conditions as inputs.
|
||||||
# NOTE: If no condition indices are passed, we just assume to
|
return [
|
||||||
# take all conditions as inputs.
|
Fulfillment(self.conditions[cid].fulfillment,
|
||||||
condition_indices = [index for index, _
|
self.conditions[cid].owners_after,
|
||||||
in enumerate(self.conditions)]
|
TransactionLink(self.id, cid))
|
||||||
|
for cid in condition_indices or range(len(self.conditions))
|
||||||
for cid in condition_indices:
|
]
|
||||||
input_cond = self.conditions[cid]
|
|
||||||
ffill = Fulfillment(input_cond.fulfillment,
|
|
||||||
input_cond.owners_after,
|
|
||||||
TransactionLink(self.id, cid))
|
|
||||||
inputs.append(ffill)
|
|
||||||
return inputs
|
|
||||||
|
|
||||||
def add_fulfillment(self, fulfillment):
|
def add_fulfillment(self, fulfillment):
|
||||||
"""Adds a Fulfillment to a Transaction's list of Fulfillments.
|
"""Adds a Fulfillment to a Transaction's list of Fulfillments.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user