diff --git a/bigchaindb/lib.py b/bigchaindb/lib.py index 61350955..12ab9dc8 100644 --- a/bigchaindb/lib.py +++ b/bigchaindb/lib.py @@ -262,8 +262,10 @@ class BigchainDB(object): def get_transactions_filtered(self, asset_id, operation=None): """Get a list of transactions filtered on some criteria """ - return backend.query.get_txids_filtered(self.connection, asset_id, - operation) + txids = backend.query.get_txids_filtered(self.connection, asset_id, + operation) + for txid in txids: + yield self.get_transaction(txid) def get_outputs_filtered(self, owner, spent=None): """Get a list of output links filtered on some criteria diff --git a/tests/test_txlist.py b/tests/test_txlist.py index 93230957..7b4f4d5d 100644 --- a/tests/test_txlist.py +++ b/tests/test_txlist.py @@ -35,11 +35,11 @@ def txlist(b, user_pk, user2_pk, user_sk, user2_sk): @pytest.mark.bdb def test_get_txlist_by_asset(b, txlist): res = b.get_transactions_filtered(txlist.create1.id) - assert sorted(set(tx for tx in res)) == sorted( + assert sorted(set(tx.id for tx in res)) == sorted( set([txlist.transfer1.id, txlist.create1.id])) @pytest.mark.bdb def test_get_txlist_by_operation(b, txlist): res = b.get_transactions_filtered(txlist.create1.id, operation='CREATE') - assert set(tx for tx in res) == {txlist.create1.id} + assert set(tx.id for tx in res) == {txlist.create1.id}