cennznet/doughnut-rs

Refactor domain_index

xlc opened this issue · 4 comments

xlc commented

domain_index: Vec<(String, usize)>,

It can be easily outdated and causing unexpected bug.

Why domains is a HashMap if is really just a Vec<String, Vec<u8>>?

HashMap is unordered, Vec is an implementation detail to preserve ordering of payloads on encoding/decoding.

xlc commented

There is no need to use HashMap at all in this case. Vec<String, Vec<u8>> is enough.

If we use vec only, then we have to do search when querying the doughnut for permission domains.
This may be the solution if we can't integrate hashmap in cennznet/plug-blockchain#15

Closed via #8