kaspanet / rusty-kaspa

Kaspa full-node and related libraries in the Rust programming language. This is a Beta version at the final testing phases.
ISC License
350 stars 105 forks source link

Add support for IP only for --rpclisten-borsh/json (#402) #439

Open gvbgduh opened 1 month ago

gvbgduh commented 1 month ago

Adds support for IP only for the --rpclisten-borsh/json flags. If a port is not provided a default port for a given network would be used.

D-Stacks commented 1 month ago

Functional part looks good to me. However tests look too repetitive. Wdyt about using array and for-loop/iterator? In addition, it is possible to make ip intanzation only once

One can call .iter() on both NetworkType, and WrpcEncoding, then just have a match on these cases, Personally i prefer this way because if new encodings, or network types, were to be added, the test can't compile without handling of new enum variants.

gvbgduh commented 1 month ago

thanks @biryukovmaxim, good points, i updated the code

One can call .iter() on both NetworkType, and WrpcEncoding, then just have a match on these cases

oh interesting, i actually did a quick docs lookup to see it's not standard functionality, but i somehow failed to see it's implemented for those enums already. it'll make code neater, thanks