coffee-tools / coffee

Reference implementation for a flexible core lightning plugin manager
https://docs.page/coffee-tools/coffee
9 stars 13 forks source link

Check for duplicate plugin #246

Closed daywalker90 closed 7 months ago

daywalker90 commented 7 months ago

I ran into an issue where i had the same plugin listed 3 times under coffee list. Since we internally use Vec to store these there is no check for duplicates on a Vec.push. We could switch to something like HashMap<String, Plugin> and use the name as the key or on every Vec.push we check if a plugin with that name already exists to prevent cases like this. I'd be willing to make these changes.

Thoughts?

vincenzopalazzo commented 7 months ago

I was discussing this with @tareknaser I remember also that he provide a patch for it but Idk why this bug is still present

Can you take a look at it @tareknaser ?

tareknaser commented 7 months ago

I remember also that he provide a patch for it but Idk why this bug is still present

I think you mean #115 but this was for duplicate repositories. I don't recall discussing this issue for plugins.

vincenzopalazzo commented 7 months ago

Ok you are right @tareknaser

This should fix the problem https://github.com/coffee-tools/coffee/pull/250

@tareknaser Can you write a test to make sure that my code works?