Skip to content

Commit

Permalink
fix value_type for support with comment
Browse files Browse the repository at this point in the history
  • Loading branch information
shyba committed Jun 2, 2021
1 parent a93ec97 commit 5f2db4b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lbry/extras/daemon/json_response_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def encode_output(self, txo, check_signature=True):
if txo.claim.is_channel:
output['has_signing_key'] = txo.has_private_key
elif txo.script.is_support_claim_data:
output['value_type'] = 'emoji'
output['value_type'] = 'comment' if txo.support.comment else 'emoji'
if check_signature and txo.signable.is_signed:
if txo.channel is not None:
output['signing_channel'] = self.encode_output(txo.channel)
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/blockchain/test_claim_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,12 +582,14 @@ async def test_support_with_comment(self):
r, = await self.txo_list(type='support')
self.assertEqual(r['txid'], support['txid'])
self.assertEqual(r['value']['comment'], "nice!")
self.assertEqual(r['value_type'], 'comment')
await self.support_abandon(txid=support['txid'], nout=0, blocking=True)
support = await self.support_create(stream, comment="anonymously great!")
self.assertEqual(support['outputs'][0]['value']['comment'], "anonymously great!")
r, = await self.txo_list(type='support', is_not_spent=True)
self.assertEqual(r['txid'], support['txid'])
self.assertEqual(r['value']['comment'], "anonymously great!")
self.assertEqual(r['value_type'], 'comment')

async def test_txo_list_resolve_supports(self):
channel = self.get_claim_id(await self.channel_create('@identity'))
Expand Down

0 comments on commit 5f2db4b

Please sign in to comment.