Skip to content

Conversation

@carlaKC
Copy link
Contributor

@carlaKC carlaKC commented Jun 25, 2025

If using SimLN as a library, you may want to use the sped up simulation clock in other places. Pass the clock into create_simulation_with_network so that it can be created (and used) externally, and the helper function just sets up the simulation using the clock it is provided.

An alternative approach to this would be to make the Simulation::clock pub, but the downside of this is that you can hit circular dependencies

  • for example, if you want to use the clock in an interceptor: you need the clock to create the interceptor, but you need to interceptor to create the simulation and thus the clock.

If using SimLN as a library, you may want to use the sped up simulation
clock in other places. Pass the clock into create_simulation_with_network
so that it can be created (and used) externally, and the helper function
just sets up the simulation using the clock it is provided.

An alternative approach to this would be to make the Simulation::clock
pub, but the downside of this is that you can hit circular dependencies
- for example, if you want to use the clock in an interceptor: you need
the clock to create the interceptor, but you need to interceptor to
create the simulation and thus the clock.
@carlaKC carlaKC merged commit 698b318 into bitcoin-dev-project:main Jun 25, 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.

2 participants