diff --git a/lbry/extras/daemon/daemon.py b/lbry/extras/daemon/daemon.py index 59f1b0750..b727df8ce 100644 --- a/lbry/extras/daemon/daemon.py +++ b/lbry/extras/daemon/daemon.py @@ -4145,7 +4145,7 @@ class Daemon(metaclass=JSONRPCServerType): --is_my_input : (bool) show outputs created by you --is_not_my_input : (bool) show outputs not created by you --exclude_internal_transfers: (bool) excludes any outputs that are exactly this combination: - --is_my_input --is_my_output --type=other + "--is_my_input --is_my_output --type=other" this allows to exclude "change" payments, this flag can be used in combination with any of the other flags --account_id= : (str) id of the account to query diff --git a/lbry/wallet/database.py b/lbry/wallet/database.py index 429c5d1c3..d5de0ef37 100644 --- a/lbry/wallet/database.py +++ b/lbry/wallet/database.py @@ -677,7 +677,7 @@ class Database(SQLiteMixin): self, cols, accounts=None, is_my_input=None, is_my_output=True, is_my_input_or_output=None, exclude_internal_transfers=False, include_is_spent=False, include_is_my_input=False, - read_only=True, **constraints): + read_only=False, **constraints): for rename_col in ('txid', 'txoid'): for rename_constraint in (rename_col, rename_col+'__in', rename_col+'__not_in'): if rename_constraint in constraints: diff --git a/tests/unit/test_cli.py b/tests/unit/test_cli.py index 64ad1a3f0..fab143d8c 100644 --- a/tests/unit/test_cli.py +++ b/tests/unit/test_cli.py @@ -218,7 +218,7 @@ class DaemonDocsTests(TestCase): try: docopt.docopt(fn.__doc__, ()) except docopt.DocoptLanguageError as err: - failures.append(f"invalid docstring for {name}, {err.message}") + failures.append(f"invalid docstring for {name}, {err.args[0]}") except docopt.DocoptExit: pass if failures: diff --git a/tests/unit/wallet/test_database.py b/tests/unit/wallet/test_database.py index 68d67515e..7ceed23d7 100644 --- a/tests/unit/wallet/test_database.py +++ b/tests/unit/wallet/test_database.py @@ -353,14 +353,14 @@ class TestQueries(AsyncioTestCase): self.assertListEqual([tx3.id, tx2.id, tx1.id], [tx.id for tx in txs]) self.assertListEqual([3, 2, 1], [tx.height for tx in txs]) - txs = await self.ledger.db.get_transactions(wallet=wallet1, accounts=wallet1.accounts) + txs = await self.ledger.db.get_transactions(wallet=wallet1, accounts=wallet1.accounts, include_is_my_output=True) self.assertListEqual([tx2.id, tx1.id], [tx.id for tx in txs]) self.assertEqual(txs[0].inputs[0].is_my_input, True) self.assertEqual(txs[0].outputs[0].is_my_output, False) self.assertEqual(txs[1].inputs[0].is_my_input, False) self.assertEqual(txs[1].outputs[0].is_my_output, True) - txs = await self.ledger.db.get_transactions(wallet=wallet2, accounts=[account2]) + txs = await self.ledger.db.get_transactions(wallet=wallet2, accounts=[account2], include_is_my_output=True) self.assertListEqual([tx3.id, tx2.id], [tx.id for tx in txs]) self.assertEqual(txs[0].inputs[0].is_my_input, True) self.assertEqual(txs[0].outputs[0].is_my_output, False) @@ -370,20 +370,20 @@ class TestQueries(AsyncioTestCase): tx = await self.ledger.db.get_transaction(txid=tx2.id) self.assertEqual(tx.id, tx2.id) - self.assertFalse(tx.inputs[0].is_my_input) - self.assertFalse(tx.outputs[0].is_my_output) - tx = await self.ledger.db.get_transaction(wallet=wallet1, txid=tx2.id) + self.assertIsNone(tx.inputs[0].is_my_input) + self.assertIsNone(tx.outputs[0].is_my_output) + tx = await self.ledger.db.get_transaction(wallet=wallet1, txid=tx2.id, include_is_my_output=True) self.assertTrue(tx.inputs[0].is_my_input) self.assertFalse(tx.outputs[0].is_my_output) - tx = await self.ledger.db.get_transaction(wallet=wallet2, txid=tx2.id) + tx = await self.ledger.db.get_transaction(wallet=wallet2, txid=tx2.id, include_is_my_output=True) self.assertFalse(tx.inputs[0].is_my_input) self.assertTrue(tx.outputs[0].is_my_output) # height 0 sorted to the top with the rest in descending order tx4 = await self.create_tx_from_nothing(account1, 0) txos = await self.ledger.db.get_txos() - self.assertListEqual([0, 2, 2, 1], [txo.tx_ref.height for txo in txos]) - self.assertListEqual([tx4.id, tx2.id, tx2b.id, tx1.id], [txo.tx_ref.id for txo in txos]) + self.assertListEqual([0, 3, 2, 2, 1], [txo.tx_ref.height for txo in txos]) + self.assertListEqual([tx4.id, tx3.id, tx2.id, tx2b.id, tx1.id], [txo.tx_ref.id for txo in txos]) txs = await self.ledger.db.get_transactions(accounts=[account1, account2]) self.assertListEqual([0, 3, 2, 1], [tx.height for tx in txs]) self.assertListEqual([tx4.id, tx3.id, tx2.id, tx1.id], [tx.id for tx in txs])