Skip to content

Commit

Permalink
refactor: rename internalID to mintID in a few places
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgemmsilva committed Sep 8, 2023
1 parent 53f2e22 commit d0f0fca
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions packages/testutil/privtangle/privtangle.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ func (pt *PrivTangle) waitAllHealthy(timeout time.Duration) {
for i := range pt.NodeCommands {
ok, err := pt.nodeClient(i).Health(pt.ctx)
if err != nil || !ok {
pt.logf("Waiting healthy... node #%d not ready yet. time waiting: %v", i, time.Since(ts).Truncate(time.Millisecond))
allOK = false
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/vm/core/accounts/internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ const (
PrefixNFTsByCollection = "c"
// prefixNewlyMintedNFTs stores a map of <position in minted list> => <newly minted NFT> to be updated when the outputID is known
prefixNewlyMintedNFTs = "N"
// prefixInternalNFTIDMap stores a map of <internal NFTID> => <NFTID> it is updated when the NFTID of newly minted nfts is known
prefixInternalNFTIDMap = "M"
// prefixMintIDMap stores a map of <internal NFTID> => <NFTID> it is updated when the NFTID of newly minted nfts is known
prefixMintIDMap = "M"
// PrefixFoundries + <agentID> stores a map of <foundrySN> (uint32) => true
PrefixFoundries = "f"

Expand Down
12 changes: 6 additions & 6 deletions packages/vm/core/accounts/nftmint.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ func newlyMintedNFTsMap(state kv.KVStore) *collections.Map {
}

func mintIDMap(state kv.KVStore) *collections.Map {
return collections.NewMap(state, prefixInternalNFTIDMap)
return collections.NewMap(state, prefixMintIDMap)
}

func mintIDMapR(state kv.KVStoreReader) *collections.ImmutableMap {
return collections.NewMapReadOnly(state, prefixInternalNFTIDMap)
return collections.NewMapReadOnly(state, prefixMintIDMap)
}

var (
Expand Down Expand Up @@ -124,7 +124,7 @@ func mintParams(ctx isc.Sandbox) mintParameters {
}
}

func internalNFTID(blockIndex uint32, positionInMintedList uint16) []byte {
func mintID(blockIndex uint32, positionInMintedList uint16) []byte {
ret := make([]byte, 6)
copy(ret[0:], codec.EncodeUint32(blockIndex))
copy(ret[4:], codec.EncodeUint16(positionInMintedList))
Expand Down Expand Up @@ -155,7 +155,7 @@ func mintNFT(ctx isc.Sandbox) dict.Dict {
newlyMintedNFTsMap(ctx.State()).SetAt(codec.Encode(positionInMintedList), rec.Bytes())

return dict.Dict{
ParamMintID: internalNFTID(ctx.StateAnchor().StateIndex+1, positionInMintedList),
ParamMintID: mintID(ctx.StateAnchor().StateIndex+1, positionInMintedList),
}
}

Expand Down Expand Up @@ -200,8 +200,8 @@ func updateNewlyMintedNFTOutputIDs(state kv.KVStore, anchorTxID iotago.Transacti
// credit the NFT to the target owner
creditNFTToAccount(state, mintedRec.owner, nftID, mintedRec.output.ImmutableFeatureSet().IssuerFeature().Address)
}
// save the mapping of [internalID => NFTID]
mintIDMap(state).SetAt(internalNFTID(blockIndex, mintedRec.positionInMintedList), nftID[:])
// save the mapping of [mintID => NFTID]
mintIDMap(state).SetAt(mintID(blockIndex, mintedRec.positionInMintedList), nftID[:])
return true
})
mintMap.Erase()
Expand Down

0 comments on commit d0f0fca

Please sign in to comment.