diff --git a/lbry/extras/daemon/daemon.py b/lbry/extras/daemon/daemon.py index 8a93e3fe4..656efdea6 100644 --- a/lbry/extras/daemon/daemon.py +++ b/lbry/extras/daemon/daemon.py @@ -4251,7 +4251,7 @@ class Daemon(metaclass=JSONRPCServerType): @requires(WALLET_COMPONENT) async def jsonrpc_txo_spend( self, account_id=None, wallet_id=None, batch_size=1000, - preview=False, blocking=False, **kwargs): + include_full_tx=False, preview=False, blocking=False, **kwargs): """ Spend transaction outputs, batching into multiple transactions as necessary. @@ -4280,6 +4280,7 @@ class Daemon(metaclass=JSONRPCServerType): --preview : (bool) do not broadcast the transaction --blocking : (bool) wait until abandon is in mempool --batch_size= : (int) number of txos to spend per transactions + --include_full_tx : (bool) include entire tx in output and not just the txid Returns: {List[Transaction]} """ @@ -4300,7 +4301,9 @@ class Daemon(metaclass=JSONRPCServerType): if not preview: for tx in txs: await self.broadcast_or_release(tx, blocking) - return txs + if include_full_tx: + return txs + return [{'txid': tx.id} for tx in txs] @requires(WALLET_COMPONENT) def jsonrpc_txo_sum(self, account_id=None, wallet_id=None, **kwargs): diff --git a/tests/integration/blockchain/test_claim_commands.py b/tests/integration/blockchain/test_claim_commands.py index 84d17da94..5520f0e88 100644 --- a/tests/integration/blockchain/test_claim_commands.py +++ b/tests/integration/blockchain/test_claim_commands.py @@ -616,7 +616,7 @@ class TransactionOutputCommands(ClaimTestCase): await self.support_create(stream_id, '0.1') await self.assertBalance(self.account, '7.978478') self.assertEqual('1.0', lbc(await self.txo_sum(type='support', unspent=True))) - txs = await self.txo_spend(type='support', batch_size=3) + txs = await self.txo_spend(type='support', batch_size=3, include_full_tx=True) self.assertEqual(4, len(txs)) self.assertEqual(3, len(txs[0]['inputs'])) self.assertEqual(3, len(txs[1]['inputs'])) @@ -625,6 +625,11 @@ class TransactionOutputCommands(ClaimTestCase): self.assertEqual('0.0', lbc(await self.txo_sum(type='support', unspent=True))) await self.assertBalance(self.account, '8.977606') + await self.support_create(stream_id, '0.1') + txs = await self.daemon.jsonrpc_txo_spend(type='support', batch_size=3) + self.assertEqual(1, len(txs)) + self.assertEqual({'txid'}, set(txs[0])) + class ClaimCommands(ClaimTestCase):