correctly split value/fee in transaction_list
This commit is contained in:
parent
443ce6352b
commit
fe844581fd
2 changed files with 11 additions and 6 deletions
|
@ -307,12 +307,14 @@ class LbryWalletManager(BaseWalletManager):
|
||||||
'support_info': [],
|
'support_info': [],
|
||||||
'abandon_info': []
|
'abandon_info': []
|
||||||
}
|
}
|
||||||
if all([txi.txo_ref.txo is not None for txi in tx.inputs]):
|
if all([txi.is_my_account for txi in tx.inputs]):
|
||||||
item['value'] = dewies_to_lbc(tx.net_account_balance - tx.fee)
|
# fees only matter if we are the ones paying them
|
||||||
item['fee'] = dewies_to_lbc(tx.fee)
|
item['value'] = dewies_to_lbc(tx.net_account_balance+tx.fee)
|
||||||
|
item['fee'] = dewies_to_lbc(-tx.fee)
|
||||||
else:
|
else:
|
||||||
|
# someone else paid the fees
|
||||||
item['value'] = dewies_to_lbc(tx.net_account_balance)
|
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:
|
for txo in tx.my_claim_outputs:
|
||||||
item['claim_info'].append({
|
item['claim_info'].append({
|
||||||
'address': txo.get_address(account.ledger),
|
'address': txo.get_address(account.ledger),
|
||||||
|
|
|
@ -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]['claim_id'], claim['claim_id'])
|
||||||
self.assertEqual(txs[0]['support_info'][0]['is_tip'], True)
|
self.assertEqual(txs[0]['support_info'][0]['is_tip'], True)
|
||||||
self.assertEqual(txs[0]['value'], '1.0')
|
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
|
# verify that the outgoing tip is marked correctly as is_tip=True in account2
|
||||||
txs2 = await self.out(
|
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]['balance_delta'], '-1.0')
|
||||||
self.assertEqual(txs2[0]['support_info'][0]['claim_id'], claim['claim_id'])
|
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]['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
|
# send a support to the claim using account2
|
||||||
support = await self.out(
|
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]['balance_delta'], '-2.0')
|
||||||
self.assertEqual(txs2[0]['support_info'][0]['claim_id'], claim['claim_id'])
|
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]['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')
|
||||||
|
|
Loading…
Reference in a new issue