simln-lib: exclude capacity from excluded nodes list#305
simln-lib: exclude capacity from excluded nodes list#305carlaKC merged 1 commit intobitcoin-dev-project:mainfrom
Conversation
carlaKC
left a comment
There was a problem hiding this comment.
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.
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.
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.
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.
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.
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.
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