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):
|
def store_transaction(self, transaction):
|
||||||
"""Store a valid transaction to the transactions collection."""
|
"""Store a valid transaction to the transactions collection."""
|
||||||
|
|
||||||
self.update_utxoset(transaction)
|
# self.update_utxoset(transaction)
|
||||||
transaction = deepcopy(transaction.to_dict())
|
transaction = deepcopy(transaction.to_dict())
|
||||||
if transaction['operation'] == 'CREATE':
|
if transaction['operation'] == 'CREATE':
|
||||||
asset = transaction.pop('asset')
|
asset = transaction.pop('asset')
|
||||||
@ -88,7 +88,7 @@ class BigchainDB(Bigchain):
|
|||||||
assets = []
|
assets = []
|
||||||
txn_metadatas = []
|
txn_metadatas = []
|
||||||
for transaction in transactions:
|
for transaction in transactions:
|
||||||
self.update_utxoset(transaction)
|
# self.update_utxoset(transaction)
|
||||||
transaction = transaction.to_dict()
|
transaction = transaction.to_dict()
|
||||||
if transaction['operation'] == 'CREATE':
|
if transaction['operation'] == 'CREATE':
|
||||||
asset = transaction.pop('asset')
|
asset = transaction.pop('asset')
|
||||||
|
@ -66,12 +66,13 @@ def test_deliver_tx__valid_create_updates_db(b):
|
|||||||
app.end_block(99)
|
app.end_block(99)
|
||||||
app.commit()
|
app.commit()
|
||||||
assert b.get_transaction(tx.id).id == tx.id
|
assert b.get_transaction(tx.id).id == tx.id
|
||||||
unspent_outputs = b.get_unspent_outputs()
|
|
||||||
unspent_output = next(unspent_outputs)
|
# unspent_outputs = b.get_unspent_outputs()
|
||||||
expected_unspent_output = next(tx.unspent_outputs)._asdict()
|
# unspent_output = next(unspent_outputs)
|
||||||
assert unspent_output == expected_unspent_output
|
# expected_unspent_output = next(tx.unspent_outputs)._asdict()
|
||||||
with pytest.raises(StopIteration):
|
# assert unspent_output == expected_unspent_output
|
||||||
next(unspent_outputs)
|
# with pytest.raises(StopIteration):
|
||||||
|
# next(unspent_outputs)
|
||||||
|
|
||||||
|
|
||||||
def test_deliver_tx__double_spend_fails(b):
|
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')
|
'bigchaindb.backend.query.store_metadatas')
|
||||||
mocked_store_transaction = mocker.patch(
|
mocked_store_transaction = mocker.patch(
|
||||||
'bigchaindb.backend.query.store_transaction')
|
'bigchaindb.backend.query.store_transaction')
|
||||||
mongo_client = MongoClient(host=db_context.host, port=db_context.port)
|
|
||||||
tb.store_transaction(signed_create_tx)
|
tb.store_transaction(signed_create_tx)
|
||||||
utxoset = mongo_client[db_context.name]['utxos']
|
# mongo_client = MongoClient(host=db_context.host, port=db_context.port)
|
||||||
assert utxoset.count() == 1
|
# utxoset = mongo_client[db_context.name]['utxos']
|
||||||
utxo = utxoset.find_one()
|
# assert utxoset.count() == 1
|
||||||
assert utxo['transaction_id'] == signed_create_tx.id
|
# utxo = utxoset.find_one()
|
||||||
assert utxo['output_index'] == 0
|
# assert utxo['transaction_id'] == signed_create_tx.id
|
||||||
|
# assert utxo['output_index'] == 0
|
||||||
mocked_store_asset.assert_called_once_with(
|
mocked_store_asset.assert_called_once_with(
|
||||||
tb.connection,
|
tb.connection,
|
||||||
{'id': signed_create_tx.id, 'data': signed_create_tx.asset['data']},
|
{'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_metadata.reset_mock()
|
||||||
mocked_store_transaction.reset_mock()
|
mocked_store_transaction.reset_mock()
|
||||||
tb.store_transaction(signed_transfer_tx)
|
tb.store_transaction(signed_transfer_tx)
|
||||||
assert utxoset.count() == 1
|
# assert utxoset.count() == 1
|
||||||
utxo = utxoset.find_one()
|
# utxo = utxoset.find_one()
|
||||||
assert utxo['transaction_id'] == signed_transfer_tx.id
|
# assert utxo['transaction_id'] == signed_transfer_tx.id
|
||||||
assert utxo['output_index'] == 0
|
# assert utxo['output_index'] == 0
|
||||||
assert not mocked_store_asset.called
|
assert not mocked_store_asset.called
|
||||||
mocked_store_metadata.asser_called_once_with(
|
mocked_store_metadata.asser_called_once_with(
|
||||||
tb.connection,
|
tb.connection,
|
||||||
@ -205,13 +205,13 @@ def test_store_bulk_transaction(mocker, tb, signed_create_tx,
|
|||||||
'bigchaindb.backend.query.store_metadatas')
|
'bigchaindb.backend.query.store_metadatas')
|
||||||
mocked_store_transactions = mocker.patch(
|
mocked_store_transactions = mocker.patch(
|
||||||
'bigchaindb.backend.query.store_transactions')
|
'bigchaindb.backend.query.store_transactions')
|
||||||
mongo_client = MongoClient(host=db_context.host, port=db_context.port)
|
|
||||||
tb.store_bulk_transactions((signed_create_tx,))
|
tb.store_bulk_transactions((signed_create_tx,))
|
||||||
utxoset = mongo_client[db_context.name]['utxos']
|
# mongo_client = MongoClient(host=db_context.host, port=db_context.port)
|
||||||
assert utxoset.count() == 1
|
# utxoset = mongo_client[db_context.name]['utxos']
|
||||||
utxo = utxoset.find_one()
|
# assert utxoset.count() == 1
|
||||||
assert utxo['transaction_id'] == signed_create_tx.id
|
# utxo = utxoset.find_one()
|
||||||
assert utxo['output_index'] == 0
|
# assert utxo['transaction_id'] == signed_create_tx.id
|
||||||
|
# assert utxo['output_index'] == 0
|
||||||
mocked_store_assets.assert_called_once_with(
|
mocked_store_assets.assert_called_once_with(
|
||||||
tb.connection,
|
tb.connection,
|
||||||
[{'id': signed_create_tx.id, 'data': signed_create_tx.asset['data']}],
|
[{'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_metadata.reset_mock()
|
||||||
mocked_store_transactions.reset_mock()
|
mocked_store_transactions.reset_mock()
|
||||||
tb.store_bulk_transactions((signed_transfer_tx,))
|
tb.store_bulk_transactions((signed_transfer_tx,))
|
||||||
assert utxoset.count() == 1
|
# assert utxoset.count() == 1
|
||||||
utxo = utxoset.find_one()
|
# utxo = utxoset.find_one()
|
||||||
assert utxo['transaction_id'] == signed_transfer_tx.id
|
# assert utxo['transaction_id'] == signed_transfer_tx.id
|
||||||
assert utxo['output_index'] == 0
|
# assert utxo['output_index'] == 0
|
||||||
assert not mocked_store_assets.called
|
assert not mocked_store_assets.called
|
||||||
mocked_store_metadata.asser_called_once_with(
|
mocked_store_metadata.asser_called_once_with(
|
||||||
tb.connection,
|
tb.connection,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user