Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Purpose of keyList in DAGSwap.sol #1

Open
lovesh opened this issue Apr 23, 2020 · 0 comments
Open

Purpose of keyList in DAGSwap.sol #1

lovesh opened this issue Apr 23, 2020 · 0 comments

Comments

@lovesh
Copy link

lovesh commented Apr 23, 2020

Wanted to understand the purpose of keyList. Its only updated when an address is being mapped mapAddress but not being updated when an address is being unmapped removeMappedAddress. That leads to creating a larger map than required in getMappedAddresses as the length of keyList doesn't decrease when addresses are unmapped.
Is the objective with keyList to track all addresses ever mapped? If yes, then wouldn't it be efficient to have keyList be a map supplemented with 1 or 2 counters to track how many addresses were ever mapped and how many are currently mapped. That way a call to mapAddress does not have to iterate over keyList.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant