Skip to content

Commit

Permalink
Hint to CAT change (#15179)
Browse files Browse the repository at this point in the history
* Hint to change

* Change cat test

* fix test_cat_spend test memo check

* Fix memos assertion again
  • Loading branch information
Quexington committed May 4, 2023
1 parent b0f65a1 commit 0346bdd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion chia/wallet/cat_wallet/cat_wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ async def generate_unsigned_spendbundle(
break
else:
change_puzhash = await self.get_new_inner_hash()
primaries.append(Payment(change_puzhash, uint64(change)))
primaries.append(Payment(change_puzhash, uint64(change), [change_puzhash]))

# Loop through the coins we've selected and gather the information we need to spend them
spendable_cat_list = []
Expand Down
6 changes: 3 additions & 3 deletions tests/wallet/cat_wallet/test_cat_wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ async def test_cat_spend(self, self_hostname, two_wallet_nodes, trusted):

await time_out_assert(20, cat_wallet.get_pending_change_balance, 40)
memos = await api_0.get_transaction_memo(dict(transaction_id=tx_id))
assert len(memos[tx_id]) == 1
assert len(memos[tx_id]) == 2 # One for tx, one for change
assert list(memos[tx_id].values())[0][0] == cat_2_hash.hex()

for i in range(1, num_blocks):
Expand All @@ -222,7 +222,7 @@ async def test_cat_spend(self, self_hostname, two_wallet_nodes, trusted):
coin = coins.pop()
tx_id = coin.name().hex()
memos = await api_1.get_transaction_memo(dict(transaction_id=tx_id))
assert len(memos[tx_id]) == 1
assert len(memos[tx_id]) == 2
assert list(memos[tx_id].values())[0][0] == cat_2_hash.hex()
cat_hash = await cat_wallet.get_new_inner_hash()
tx_records = await cat_wallet_2.generate_signed_transaction([uint64(15)], [cat_hash])
Expand Down Expand Up @@ -605,7 +605,7 @@ async def test_cat_spend_multiple(self, self_hostname, three_wallet_nodes, trust
for tx in txs:
if tx.amount == 30:
memos = tx.get_memos()
assert len(memos) == 1
assert len(memos) == 2 # One for tx, one for change
assert b"Markus Walburg" in [v for v_list in memos.values() for v in v_list]
assert list(memos.keys())[0] in [a.name() for a in tx.spend_bundle.additions()]

Expand Down

0 comments on commit 0346bdd

Please sign in to comment.