Fix DID ID mismatch

This commit is contained in:
ytx1991 2022-06-28 11:10:16 -07:00
parent 56c0868fe9
commit 5f7f2c13a6
No known key found for this signature in database
GPG Key ID: 1B767F8CA343E501
2 changed files with 18 additions and 1 deletions

View File

@ -1588,11 +1588,17 @@ class WalletRpcApi:
# Note: This is not the actual unspent NFT full puzzle.
# There is no way to rebuild the full puzzle in a different wallet.
# But it shouldn't have impact on generating the NFTInfo, since inner_puzzle is not used there.
if uncurried_nft.supports_did:
inner_puzzle = nft_puzzles.recurry_nft_puzzle(
uncurried_nft, coin_spend.solution.to_program(), uncurried_nft.p2_puzzle
)
else:
inner_puzzle = uncurried_nft.p2_puzzle
full_puzzle = nft_puzzles.create_full_puzzle(
uncurried_nft.singleton_launcher_id,
metadata,
uncurried_nft.metadata_updater_hash,
uncurried_nft.inner_puzzle,
inner_puzzle,
)
# Get launcher coin

View File

@ -1220,6 +1220,10 @@ async def test_nft_set_did(two_wallet_nodes: Any, trusted: Any) -> None:
assert coins[0].owner_did.hex() == hex_did_id
nft_coin_id = coins[0].nft_coin_id
resp = await api_0.nft_get_info(dict(coin_id=nft_coin_id.hex(), latest=True))
assert resp["success"]
assert coins[0] == resp["nft_info"]
# Test set DID1 -> DID2
hex_did_id = did_wallet1.get_my_DID()
hmr_did_id = encode_puzzle_hash(bytes32.from_hexstr(hex_did_id), DID_HRP)
@ -1245,6 +1249,9 @@ async def test_nft_set_did(two_wallet_nodes: Any, trusted: Any) -> None:
assert len(coins) == 1
assert coins[0].owner_did.hex() == hex_did_id
nft_coin_id = coins[0].nft_coin_id
resp = await api_0.nft_get_info(dict(coin_id=nft_coin_id.hex(), latest=True))
assert resp["success"]
assert coins[0] == resp["nft_info"]
# Test set DID2 -> None
resp = await api_0.nft_set_nft_did(dict(wallet_id=nft_wallet_2_id, nft_coin_id=nft_coin_id.hex()))
await make_new_block_with(resp, full_node_api, ph)
@ -1257,6 +1264,10 @@ async def test_nft_set_did(two_wallet_nodes: Any, trusted: Any) -> None:
assert len(coins) == 1
assert coins[0].owner_did is None
assert len(wallet_node_0.wallet_state_manager.wallets[nft_wallet_2_id].my_nft_coins) == 0
nft_coin_id = coins[0].nft_coin_id
resp = await api_0.nft_get_info(dict(coin_id=nft_coin_id.hex(), latest=True))
assert resp["success"]
assert coins[0] == resp["nft_info"]
@pytest.mark.parametrize(