Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
for index in indices:
subfulfillment_source = subfulfillment_source.subconditions[index]['body']
# sign the fulfillment
subfulfillment_source.sign(tx_escrow_execute_fulfillment_message, bigchaindb.crypto.SigningKey(sk))
# get the indices path for the other source that delivers the condition
_, indices = get_subcondition_indices_from_vk(escrow_fulfillment, other_owner)
subfulfillment_other = escrow_fulfillment.subconditions[indices[0]]['body']
# update the condition
del escrow_fulfillment.subconditions[indices[0]]
escrow_fulfillment.add_subcondition(subfulfillment_other.condition)
if execution_fulfillment:
_, indices = get_subcondition_indices_from_type(escrow_fulfillment, cc.PreimageSha256Fulfillment.TYPE_ID)
del escrow_fulfillment.subconditions[indices[0]]['body'].subconditions[indices[1]]
escrow_fulfillment.subconditions[indices[0]]['body'].add_subfulfillment_uri(execution_fulfillment)
asset_escrow_fulfill['transaction']['fulfillments'][0]['fulfillment'] = escrow_fulfillment.serialize_uri()
bigchain.write_transaction(asset_escrow_fulfill)
return asset_escrow_fulfill
hop = ilp_header['hops'][0]
ledger = get_bigchain(ledger_id=hop['ledger'])
tx_escrow = ledger.get_transaction(hop['txid'])
source = self.accounts[hop['ledger']]['vk']
to = source
asset_id = {
'txid': hop['txid'],
'cid': 0
}
sk = self.accounts[hop['ledger']]['sk']
fulfillment = cc.Fulfillment.from_uri(tx['transaction']['fulfillments'][0]['fulfillment'])
hashlocks, _ = get_subcondition_indices_from_type(fulfillment, cc.PreimageSha256Fulfillment.TYPE_ID)
execution_fulfillment = hashlocks[0].serialize_uri()
fulfill_escrow_asset(bigchain=ledger,
source=source,
to=to,
asset_id=asset_id,
sk=sk,
execution_fulfillment=execution_fulfillment)
})
destination_ledger_id = ilp_header['ledger']
ledger = get_bigchain(ledger_id=destination_ledger_id)
source = self.accounts[destination_ledger_id]['vk']
to = ilp_header['account']
asset_id = ledger.get_owned_ids(source).pop()
sk = self.accounts[destination_ledger_id]['sk']
condition = cc.Fulfillment.from_dict(tx['transaction']['conditions'][0]['condition']['details'])
timelocks, _ = get_subcondition_indices_from_type(condition, cc.TimeoutFulfillment.TYPE_ID)
expires_at = timelocks[0].expire_time.decode()
hashlocks, _ = get_subcondition_indices_from_type(condition, cc.PreimageSha256Fulfillment.TYPE_ID)
execution_condition = hashlocks[0].serialize_uri()
escrow_asset(bigchain=ledger,
source=source,
to=to,
asset_id=asset_id,
sk=sk,
expires_at=expires_at,
ilp_header=ilp_header,
execution_condition=execution_condition)