zack-bitcoin / amoveo

A blockchain for trust-free markets in financial derivatives
Other
464 stars 110 forks source link

add white list config setting #220

Closed silvesterdrago closed 5 years ago

zack-bitcoin commented 5 years ago

Why are you called Charles Manson? I don't want that name associated with Amoveo.

zack-bitcoin commented 5 years ago

Cool. I like how you used a set to store these values. That is exactly the correct data-structure for maintaining a white list.

The part I don't like is how you re-calculate the same set every time you use it. Every time ?WL happens, the white_list() function is called, and the set is built again. Building the entire set just to look up one thing from the set is not efficient.

It seems to me our choices are: 1) we could maintain a set of white list peers in ram. This algorithm would be O(log(length of white list)), and would require making a new gen_server, around 30 lines of code.

2) we could have a hard-coded list of peers in the config file, and scan through the entire list every time anyone sends our server a message. This algorithm would be O(length of white list), and would require writing like 4 lines of code.

It seems like (1) is more complicated, but (2) is more likely to result in speed issues.

I will merge your changes, and then make some more changes to achieve goal (1).

I just noticed your user name. Now I am considering not merging, and re-writing your idea myself. I don't want "charles manson" in the list of contributors.

zack-bitcoin commented 5 years ago

https://github.com/zack-bitcoin/amoveo/commit/1a801743b3d77bfbdbd72eac700e5e3cdbbfe70d This update achieves the goal.