Skip to content

Conversation

@elnosh
Copy link
Collaborator

@elnosh elnosh commented Sep 18, 2025

fixes #304

added an exclude_capacity field to SimulatedChannel to then exclude that channel capacity for the node when creating the SimGraph

@elnosh elnosh requested a review from carlaKC September 18, 2025 20:21
Copy link
Contributor

@carlaKC carlaKC left a 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 🙏

Comment on lines 285 to 287
let mut sim_channel = SimulatedChannel::from(channel);
sim_channel.exclude_capacity = exclude_capacity;
sim_channel
Copy link
Contributor

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?

Copy link
Collaborator Author

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 👍

short_channel_id: ShortChannelID,
node_1: ChannelState,
node_2: ChannelState,
pub exclude_capacity: bool,
Copy link
Contributor

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 {
Copy link
Contributor

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.

Copy link
Collaborator Author

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?

Copy link
Contributor

@carlaKC carlaKC left a 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.

@carlaKC carlaKC merged commit ec1aa36 into bitcoin-dev-project:main Sep 22, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Excluded channels contribute to random activity generation

2 participants