mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Fixed typo
Renamed some variables to make the code more readable
This commit is contained in:
parent
a2e28ae806
commit
d8be9ac3ec
@ -714,8 +714,8 @@ class Transaction(object):
|
|||||||
raise ValueError('`owners_after` list cannot be empty')
|
raise ValueError('`owners_after` list cannot be empty')
|
||||||
|
|
||||||
metadata = Metadata(metadata)
|
metadata = Metadata(metadata)
|
||||||
ffills = []
|
fulfillments = []
|
||||||
conds = []
|
conditions = []
|
||||||
|
|
||||||
# generate_conditions
|
# generate_conditions
|
||||||
for owner_after in owners_after:
|
for owner_after in owners_after:
|
||||||
@ -724,12 +724,12 @@ class Transaction(object):
|
|||||||
' tuple of `([<list of public keys>],'
|
' tuple of `([<list of public keys>],'
|
||||||
' <amount>)`'))
|
' <amount>)`'))
|
||||||
pub_keys, amount = owner_after
|
pub_keys, amount = owner_after
|
||||||
conds.append(Condition.generate(pub_keys, amount))
|
conditions.append(Condition.generate(pub_keys, amount))
|
||||||
|
|
||||||
# generate fulfillments
|
# generate fulfillments
|
||||||
ffills.append(Fulfillment.generate(owners_before))
|
fulfillments.append(Fulfillment.generate(owners_before))
|
||||||
|
|
||||||
return cls(cls.CREATE, asset, ffills, conds, metadata)
|
return cls(cls.CREATE, asset, fulfillments, conditions, metadata)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def transfer(cls, inputs, owners_after, asset, metadata=None):
|
def transfer(cls, inputs, owners_after, asset, metadata=None):
|
||||||
@ -779,18 +779,18 @@ class Transaction(object):
|
|||||||
if len(owners_after) == 0:
|
if len(owners_after) == 0:
|
||||||
raise ValueError('`owners_after` list cannot be empty')
|
raise ValueError('`owners_after` list cannot be empty')
|
||||||
|
|
||||||
conds = []
|
conditions = []
|
||||||
for owner_after in owners_after:
|
for owner_after in owners_after:
|
||||||
if not isinstance(owner_after, tuple) or len(owner_after) != 2:
|
if not isinstance(owner_after, tuple) or len(owner_after) != 2:
|
||||||
raise ValueError(('Each `owner_after` in the list must be a'
|
raise ValueError(('Each `owner_after` in the list must be a'
|
||||||
' tuple of `([<list of public keys>],'
|
' tuple of `([<list of public keys>],'
|
||||||
' <amount>)`'))
|
' <amount>)`'))
|
||||||
pub_keys, amount = owner_after
|
pub_keys, amount = owner_after
|
||||||
conds.append(Condition.generate(pub_keys, amount))
|
conditions.append(Condition.generate(pub_keys, amount))
|
||||||
|
|
||||||
metadata = Metadata(metadata)
|
metadata = Metadata(metadata)
|
||||||
inputs = deepcopy(inputs)
|
inputs = deepcopy(inputs)
|
||||||
return cls(cls.TRANSFER, asset, inputs, conds, metadata)
|
return cls(cls.TRANSFER, asset, inputs, conditions, metadata)
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
try:
|
try:
|
||||||
|
@ -90,7 +90,7 @@ class Transaction(Transaction):
|
|||||||
output_amount = sum([condition.amount for
|
output_amount = sum([condition.amount for
|
||||||
condition in self.conditions])
|
condition in self.conditions])
|
||||||
if output_amount != input_amount:
|
if output_amount != input_amount:
|
||||||
raise AmountError(('The amout used in the inputs `{}`'
|
raise AmountError(('The amount used in the inputs `{}`'
|
||||||
' needs to be same as the amount used'
|
' needs to be same as the amount used'
|
||||||
' in the outputs `{}`')
|
' in the outputs `{}`')
|
||||||
.format(input_amount, output_amount))
|
.format(input_amount, output_amount))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user