mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
multiple outputs in create transaction
This commit is contained in:
parent
63f5879cb2
commit
48084ec47a
@ -752,19 +752,16 @@ class Transaction(object):
|
||||
return cls(cls.CREATE, asset, [ffill_tx], [cond_tx], metadata)
|
||||
|
||||
elif len(owners_before) == len(owners_after) and len(owners_after) > 1:
|
||||
raise NotImplementedError('Multiple inputs and outputs not'
|
||||
'available for CREATE')
|
||||
# NOTE: Multiple inputs and outputs case. Currently not supported.
|
||||
ffills = [Fulfillment(Ed25519Fulfillment(public_key=owner_before),
|
||||
[owner_before])
|
||||
for owner_before in owners_before]
|
||||
conds = [Condition.generate(owners, amount=amount)
|
||||
conds = [Condition.generate([owners], amount=amount)
|
||||
for owners in owners_after]
|
||||
return cls(cls.CREATE, asset, ffills, conds, metadata)
|
||||
|
||||
elif len(owners_before) == 1 and len(owners_after) > 1:
|
||||
# NOTE: Multiple owners case
|
||||
cond_tx = Condition.generate(owners_after)
|
||||
cond_tx = Condition.generate(owners_after, amount=amount)
|
||||
ffill = Ed25519Fulfillment(public_key=owners_before[0])
|
||||
ffill_tx = Fulfillment(ffill, owners_before)
|
||||
return cls(cls.CREATE, asset, [ffill_tx], [cond_tx], metadata)
|
||||
|
@ -816,14 +816,14 @@ def test_create_create_transaction_multiple_io(user_cond, user2_cond, user_pub,
|
||||
assert tx == expected
|
||||
|
||||
|
||||
@mark.skip(reason='Multiple inputs and outputs in CREATE not supported')
|
||||
# @mark.skip(reason='Multiple inputs and outputs in CREATE not supported')
|
||||
# TODO: Add digital assets
|
||||
def test_validate_multiple_io_create_transaction(user_pub, user_priv,
|
||||
user2_pub, user2_priv):
|
||||
from bigchaindb.common.transaction import Transaction
|
||||
|
||||
tx = Transaction.create([user_pub, user2_pub], [user_pub, user2_pub],
|
||||
{'message': 'hello'})
|
||||
metadata={'message': 'hello'})
|
||||
tx = tx.sign([user_priv, user2_priv])
|
||||
assert tx.fulfillments_valid() is True
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user