output_condition from fid instead of cid

This commit is contained in:
diminator 2016-05-11 19:18:56 +02:00
parent c623ca56d0
commit 0c9777686d
No known key found for this signature in database
GPG Key ID: C3D8590E6D0D439A
2 changed files with 2 additions and 4 deletions

View File

@ -481,7 +481,7 @@ def get_fulfillment_message(transaction, fulfillment, serialized=False):
fulfillment_message.update({
'input': fulfillment['input'],
'input_condition': None,
'output_condition': None
'output_condition': transaction['transaction']['conditions'][fulfillment['fid']]
})
# if `TRANSFER` transaction
@ -490,14 +490,12 @@ def get_fulfillment_message(transaction, fulfillment, serialized=False):
previous_tx = b.get_transaction(fulfillment['input']['txid'])
conditions = sorted(previous_tx['transaction']['conditions'], key=lambda d: d['cid'])
fulfillment_message['input_condition'] = conditions[fulfillment['input']['cid']]
fulfillment_message['output_condition'] = transaction['transaction']['conditions'][fulfillment['input']['cid']]
# if `CREATE` transaction
# there is no previous transaction so we need to create one on the fly
else:
current_owner = transaction['transaction']['fulfillments'][0]['current_owners'][0]
condition = json.loads(cc.Ed25519Fulfillment(public_key=current_owner).serialize_json())
fulfillment_message['input_condition'] = {'condition': {'details': condition}}
fulfillment_message['output_condition'] = transaction['transaction']['conditions'][0]
if serialized:
return serialize(fulfillment_message)
return fulfillment_message

View File

@ -1279,7 +1279,7 @@ class TestFulfillmentMessage(object):
assert fulfillment_message['timestamp'] == tx['transaction']['timestamp']
assert fulfillment_message['version'] == tx['version']
assert fulfillment_message['output_condition'] == \
tx['transaction']['conditions'][original_fulfillment['input']['cid']]
tx['transaction']['conditions'][original_fulfillment['fid']]
class TestCryptoconditions(object):