-
Notifications
You must be signed in to change notification settings - Fork 38
simln-lib: exclude capacity from excluded nodes list #305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
carlaKC
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just nits and a test-beg 🙏
sim-cli/src/parsing.rs
Outdated
| let mut sim_channel = SimulatedChannel::from(channel); | ||
| sim_channel.exclude_capacity = exclude_capacity; | ||
| sim_channel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: We could give up on the strict API of From and just use new directly to shorten this a bit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
he, cool. I did the ugly pub exclude_capacity as you pointed below to keep the From. Changed to use new 👍
simln-lib/src/sim_node.rs
Outdated
| short_channel_id: ShortChannelID, | ||
| node_1: ChannelState, | ||
| node_2: ChannelState, | ||
| pub exclude_capacity: bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another point for setting this in new, wouldn't need to make one field pub.
Also probably needs a comment to explain what we're excluding capacity from.
| vec![channel.capacity_msat], | ||
| )); | ||
| }, | ||
| if !channel.exclude_capacity { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we add a very simple test that:
- Creates a graph with an excluded channel
- Creates
ln_node_from_graph - Asserts that capacities don't include the excluded channel
Would be nice to have the whole flow covered.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added test for the the simple case.
Would be nice to have the whole flow covered.
For this, do you mean flow from creating the simulation with create_simulation_with_network and nodes balances returned from that?
930f9dc to
46d45f7
Compare
carlaKC
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the test - LGTM!
Feel free to squash + merge.
46d45f7 to
39257da
Compare
fixes #304
added an
exclude_capacityfield toSimulatedChannelto then exclude that channel capacity for the node when creating theSimGraph