diff --git a/lbry/extras/daemon/daemon.py b/lbry/extras/daemon/daemon.py index 5994de5211..805b342d61 100644 --- a/lbry/extras/daemon/daemon.py +++ b/lbry/extras/daemon/daemon.py @@ -2617,7 +2617,6 @@ async def jsonrpc_channel_create( ) txo = tx.outputs[0] await txo.generate_channel_private_key() - tx._reset() await tx.sign(funding_accounts) @@ -2774,7 +2773,6 @@ async def jsonrpc_channel_update( new_txo.private_key = old_txo.private_key new_txo.script.generate() - tx._reset() await tx.sign(funding_accounts) @@ -3345,7 +3343,6 @@ async def jsonrpc_stream_create( file_stream = await self.file_manager.create_stream(file_path) claim.stream.source.sd_hash = file_stream.sd_hash new_txo.script.generate() - tx._reset() if channel: new_txo.sign(channel) @@ -3565,7 +3562,6 @@ async def jsonrpc_stream_update( file_stream = await self.file_manager.create_stream(file_path) new_txo.claim.stream.source.sd_hash = file_stream.sd_hash new_txo.script.generate() - tx._reset() stream_hash = file_stream.stream_hash elif old_stream: stream_hash = old_stream.stream_hash @@ -3960,9 +3956,6 @@ async def jsonrpc_collection_update( ) new_txo = tx.outputs[0] - new_txo.script.generate() - tx._reset() - if channel: new_txo.sign(channel) await tx.sign(funding_accounts) diff --git a/lbry/wallet/transaction.py b/lbry/wallet/transaction.py index c05d7bc124..9856d274a5 100644 --- a/lbry/wallet/transaction.py +++ b/lbry/wallet/transaction.py @@ -850,6 +850,7 @@ def signature_hash_type(hash_type): return hash_type async def sign(self, funding_accounts: Iterable['Account']): + self._reset() ledger, wallet = self.ensure_all_have_same_ledger_and_wallet(funding_accounts) for i, txi in enumerate(self._inputs): assert txi.script is not None diff --git a/tests/integration/blockchain/test_claim_commands.py b/tests/integration/blockchain/test_claim_commands.py index ce9859de69..679dd85b8e 100644 --- a/tests/integration/blockchain/test_claim_commands.py +++ b/tests/integration/blockchain/test_claim_commands.py @@ -1976,10 +1976,14 @@ async def test_regular_supports_and_tip_supports(self): self.assertTrue(txs[1]['support_info'][0]['is_tip']) self.assertTrue(txs[1]['support_info'][0]['is_spent']) - async def test_signed_supports(self): + async def test_signed_supports_with_no_change_txo_regression(self): + # reproduces a bug where transactions did not get properly signed + # if there was no change and just a single output + # lbrycrd returned 'the transaction was rejected by network rules.' channel_id = self.get_claim_id(await self.channel_create()) stream_id = self.get_claim_id(await self.stream_create()) - tx = await self.support_create(stream_id, '0.3', channel_id=channel_id) + tx = await self.support_create(stream_id, '7.967598', channel_id=channel_id) + self.assertEqual(len(tx['outputs']), 1) # must be one to reproduce bug self.assertTrue(tx['outputs'][0]['is_channel_signature_valid'])