add and test support for support_create anonymous --comment
This commit is contained in:
parent
67cce0ef7e
commit
a638aa9d53
2 changed files with 11 additions and 4 deletions
|
@ -928,14 +928,15 @@ class Transaction:
|
||||||
funding_accounts: List['Account'], change_account: 'Account', signing_channel: Output = None,
|
funding_accounts: List['Account'], change_account: 'Account', signing_channel: Output = None,
|
||||||
comment: str = None):
|
comment: str = None):
|
||||||
ledger, _ = cls.ensure_all_have_same_ledger_and_wallet(funding_accounts, change_account)
|
ledger, _ = cls.ensure_all_have_same_ledger_and_wallet(funding_accounts, change_account)
|
||||||
if signing_channel is not None:
|
if signing_channel is not None or comment is not None:
|
||||||
support = Support()
|
support = Support()
|
||||||
support.emoji = '👍'
|
if comment is not None:
|
||||||
support.comment = comment
|
support.comment = comment
|
||||||
support_output = Output.pay_support_data_pubkey_hash(
|
support_output = Output.pay_support_data_pubkey_hash(
|
||||||
amount, claim_name, claim_id, support, ledger.address_to_hash160(holding_address)
|
amount, claim_name, claim_id, support, ledger.address_to_hash160(holding_address)
|
||||||
)
|
)
|
||||||
support_output.sign(signing_channel, b'placeholder txid:nout')
|
if signing_channel is not None:
|
||||||
|
support_output.sign(signing_channel, b'placeholder txid:nout')
|
||||||
else:
|
else:
|
||||||
support_output = Output.pay_support_pubkey_hash(
|
support_output = Output.pay_support_pubkey_hash(
|
||||||
amount, claim_name, claim_id, ledger.address_to_hash160(holding_address)
|
amount, claim_name, claim_id, ledger.address_to_hash160(holding_address)
|
||||||
|
|
|
@ -582,6 +582,12 @@ class TransactionOutputCommands(ClaimTestCase):
|
||||||
r, = await self.txo_list(type='support')
|
r, = await self.txo_list(type='support')
|
||||||
self.assertEqual(r['txid'], support['txid'])
|
self.assertEqual(r['txid'], support['txid'])
|
||||||
self.assertEqual(r['value']['comment'], "nice!")
|
self.assertEqual(r['value']['comment'], "nice!")
|
||||||
|
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!")
|
||||||
|
|
||||||
async def test_txo_list_resolve_supports(self):
|
async def test_txo_list_resolve_supports(self):
|
||||||
channel = self.get_claim_id(await self.channel_create('@identity'))
|
channel = self.get_claim_id(await self.channel_create('@identity'))
|
||||||
|
|
Loading…
Add table
Reference in a new issue