diff --git a/lbrynet/extras/wallet/manager.py b/lbrynet/extras/wallet/manager.py index c6ed1ac34..0b58b6bc0 100644 --- a/lbrynet/extras/wallet/manager.py +++ b/lbrynet/extras/wallet/manager.py @@ -307,12 +307,14 @@ class LbryWalletManager(BaseWalletManager): 'support_info': [], 'abandon_info': [] } - if all([txi.txo_ref.txo is not None for txi in tx.inputs]): - item['value'] = dewies_to_lbc(tx.net_account_balance - tx.fee) - item['fee'] = dewies_to_lbc(tx.fee) + if all([txi.is_my_account for txi in tx.inputs]): + # fees only matter if we are the ones paying them + item['value'] = dewies_to_lbc(tx.net_account_balance+tx.fee) + item['fee'] = dewies_to_lbc(-tx.fee) else: + # someone else paid the fees item['value'] = dewies_to_lbc(tx.net_account_balance) - item['fee'] = '0' # can't calculate fee without all input txos + item['fee'] = '0.0' for txo in tx.my_claim_outputs: item['claim_info'].append({ 'address': txo.get_address(account.ledger), diff --git a/tests/integration/wallet/test_commands.py b/tests/integration/wallet/test_commands.py index f1414c59e..a81f7a32a 100644 --- a/tests/integration/wallet/test_commands.py +++ b/tests/integration/wallet/test_commands.py @@ -674,6 +674,7 @@ class ClaimManagement(CommandTestCase): self.assertEqual(txs[0]['support_info'][0]['claim_id'], claim['claim_id']) self.assertEqual(txs[0]['support_info'][0]['is_tip'], True) self.assertEqual(txs[0]['value'], '1.0') + self.assertEqual(txs[0]['fee'], '0.0') # verify that the outgoing tip is marked correctly as is_tip=True in account2 txs2 = await self.out( @@ -683,7 +684,8 @@ class ClaimManagement(CommandTestCase): self.assertEqual(txs2[0]['support_info'][0]['balance_delta'], '-1.0') self.assertEqual(txs2[0]['support_info'][0]['claim_id'], claim['claim_id']) self.assertEqual(txs2[0]['support_info'][0]['is_tip'], True) - self.assertEqual(txs2[0]['value'], '-1.0001415') + self.assertEqual(txs2[0]['value'], '-1.0') + self.assertEqual(txs2[0]['fee'], '-0.0001415') # send a support to the claim using account2 support = await self.out( @@ -703,4 +705,5 @@ class ClaimManagement(CommandTestCase): self.assertEqual(txs2[0]['support_info'][0]['balance_delta'], '-2.0') self.assertEqual(txs2[0]['support_info'][0]['claim_id'], claim['claim_id']) self.assertEqual(txs2[0]['support_info'][0]['is_tip'], False) - self.assertEqual(txs2[0]['value'], '-0.0001415') + self.assertEqual(txs2[0]['value'], '0.0') + self.assertEqual(txs2[0]['fee'], '-0.0001415')