mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Problem: UTXO implementation unfinished for release. (#2132)
Solution: Rollback UTXO for the alpha release.
This commit is contained in:
parent
617f0ba94b
commit
8c32ae798b
@ -67,7 +67,7 @@ class BigchainDB(Bigchain):
|
||||
def store_transaction(self, transaction):
|
||||
"""Store a valid transaction to the transactions collection."""
|
||||
|
||||
self.update_utxoset(transaction)
|
||||
# self.update_utxoset(transaction)
|
||||
transaction = deepcopy(transaction.to_dict())
|
||||
if transaction['operation'] == 'CREATE':
|
||||
asset = transaction.pop('asset')
|
||||
@ -88,7 +88,7 @@ class BigchainDB(Bigchain):
|
||||
assets = []
|
||||
txn_metadatas = []
|
||||
for transaction in transactions:
|
||||
self.update_utxoset(transaction)
|
||||
# self.update_utxoset(transaction)
|
||||
transaction = transaction.to_dict()
|
||||
if transaction['operation'] == 'CREATE':
|
||||
asset = transaction.pop('asset')
|
||||
|
@ -66,12 +66,13 @@ def test_deliver_tx__valid_create_updates_db(b):
|
||||
app.end_block(99)
|
||||
app.commit()
|
||||
assert b.get_transaction(tx.id).id == tx.id
|
||||
unspent_outputs = b.get_unspent_outputs()
|
||||
unspent_output = next(unspent_outputs)
|
||||
expected_unspent_output = next(tx.unspent_outputs)._asdict()
|
||||
assert unspent_output == expected_unspent_output
|
||||
with pytest.raises(StopIteration):
|
||||
next(unspent_outputs)
|
||||
|
||||
# unspent_outputs = b.get_unspent_outputs()
|
||||
# unspent_output = next(unspent_outputs)
|
||||
# expected_unspent_output = next(tx.unspent_outputs)._asdict()
|
||||
# assert unspent_output == expected_unspent_output
|
||||
# with pytest.raises(StopIteration):
|
||||
# next(unspent_outputs)
|
||||
|
||||
|
||||
def test_deliver_tx__double_spend_fails(b):
|
||||
|
@ -156,13 +156,13 @@ def test_store_transaction(mocker, tb, signed_create_tx,
|
||||
'bigchaindb.backend.query.store_metadatas')
|
||||
mocked_store_transaction = mocker.patch(
|
||||
'bigchaindb.backend.query.store_transaction')
|
||||
mongo_client = MongoClient(host=db_context.host, port=db_context.port)
|
||||
tb.store_transaction(signed_create_tx)
|
||||
utxoset = mongo_client[db_context.name]['utxos']
|
||||
assert utxoset.count() == 1
|
||||
utxo = utxoset.find_one()
|
||||
assert utxo['transaction_id'] == signed_create_tx.id
|
||||
assert utxo['output_index'] == 0
|
||||
# mongo_client = MongoClient(host=db_context.host, port=db_context.port)
|
||||
# utxoset = mongo_client[db_context.name]['utxos']
|
||||
# assert utxoset.count() == 1
|
||||
# utxo = utxoset.find_one()
|
||||
# assert utxo['transaction_id'] == signed_create_tx.id
|
||||
# assert utxo['output_index'] == 0
|
||||
mocked_store_asset.assert_called_once_with(
|
||||
tb.connection,
|
||||
{'id': signed_create_tx.id, 'data': signed_create_tx.asset['data']},
|
||||
@ -180,10 +180,10 @@ def test_store_transaction(mocker, tb, signed_create_tx,
|
||||
mocked_store_metadata.reset_mock()
|
||||
mocked_store_transaction.reset_mock()
|
||||
tb.store_transaction(signed_transfer_tx)
|
||||
assert utxoset.count() == 1
|
||||
utxo = utxoset.find_one()
|
||||
assert utxo['transaction_id'] == signed_transfer_tx.id
|
||||
assert utxo['output_index'] == 0
|
||||
# assert utxoset.count() == 1
|
||||
# utxo = utxoset.find_one()
|
||||
# assert utxo['transaction_id'] == signed_transfer_tx.id
|
||||
# assert utxo['output_index'] == 0
|
||||
assert not mocked_store_asset.called
|
||||
mocked_store_metadata.asser_called_once_with(
|
||||
tb.connection,
|
||||
@ -205,13 +205,13 @@ def test_store_bulk_transaction(mocker, tb, signed_create_tx,
|
||||
'bigchaindb.backend.query.store_metadatas')
|
||||
mocked_store_transactions = mocker.patch(
|
||||
'bigchaindb.backend.query.store_transactions')
|
||||
mongo_client = MongoClient(host=db_context.host, port=db_context.port)
|
||||
tb.store_bulk_transactions((signed_create_tx,))
|
||||
utxoset = mongo_client[db_context.name]['utxos']
|
||||
assert utxoset.count() == 1
|
||||
utxo = utxoset.find_one()
|
||||
assert utxo['transaction_id'] == signed_create_tx.id
|
||||
assert utxo['output_index'] == 0
|
||||
# mongo_client = MongoClient(host=db_context.host, port=db_context.port)
|
||||
# utxoset = mongo_client[db_context.name]['utxos']
|
||||
# assert utxoset.count() == 1
|
||||
# utxo = utxoset.find_one()
|
||||
# assert utxo['transaction_id'] == signed_create_tx.id
|
||||
# assert utxo['output_index'] == 0
|
||||
mocked_store_assets.assert_called_once_with(
|
||||
tb.connection,
|
||||
[{'id': signed_create_tx.id, 'data': signed_create_tx.asset['data']}],
|
||||
@ -229,10 +229,10 @@ def test_store_bulk_transaction(mocker, tb, signed_create_tx,
|
||||
mocked_store_metadata.reset_mock()
|
||||
mocked_store_transactions.reset_mock()
|
||||
tb.store_bulk_transactions((signed_transfer_tx,))
|
||||
assert utxoset.count() == 1
|
||||
utxo = utxoset.find_one()
|
||||
assert utxo['transaction_id'] == signed_transfer_tx.id
|
||||
assert utxo['output_index'] == 0
|
||||
# assert utxoset.count() == 1
|
||||
# utxo = utxoset.find_one()
|
||||
# assert utxo['transaction_id'] == signed_transfer_tx.id
|
||||
# assert utxo['output_index'] == 0
|
||||
assert not mocked_store_assets.called
|
||||
mocked_store_metadata.asser_called_once_with(
|
||||
tb.connection,
|
||||
|
Loading…
x
Reference in New Issue
Block a user