Closed guillaumemichel closed 10 months ago
The duplicate code in key.go is only for convenience. go-kademilia doesn't depend on the key size but having those common ones available makes it easier to test. We could move kad8 and kad32 to kadtest and retain kad256 (perhaps other users might want to supply their own kad160)
The primary reasons for adding a generic typesafe key interface:
OK, I am now convinced :+1:
There is a lot of duplicate code in key.go. At the first look, having a distinct type for each keysize doesn't seem like a best practice.
What was the reasoning to replace the generic key implementation with the current static one? The generic key implementation seems easier to read and more concise. I am certainly missing the benefits that the current approach brings.