Skip to content

Conversation

@rustyrussell
Copy link
Contributor

@rustyrussell rustyrussell commented Sep 19, 2025

Depends on #8555

This attempts to make our behavior deterministic, and robust against changes, so we can generate repeatable examples. This is not entirely successful: when we interact with other daemons, timing can be an issue (such as multifundchannel), but it works in a limited way.

Changelog-None: development stuff only

@rustyrussell rustyrussell added this to the v25.12 milestone Sep 19, 2025
@rustyrussell rustyrussell force-pushed the deterministic-daemons branch 3 times, most recently from 1fb7961 to 2047615 Compare November 13, 2025 04:15
…LN_DEV_ENTROPY_SEED

Only in developer mode, ofc.

Notes:
1. We have to move the initialization before the lightningd main trace_start,
   since that uses pseudorand().
2. To make the results stable, we need to use per-caller values to randbytes().
   Otherwise external timing changes the call order.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This allows us to override it for deterministic results.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
…tion for timeouts.

This is immune to things like clock changes, and has the convenient side-effect that
it will *not* be overridden when we override time for developer purposes.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Except for tracing, that sticks with time_now().

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
…ith CLN_DEV_ENTROPY_SEED.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
…istincoming.

This ensures that bolt11/bolt12 selection of routehints/blinded paths is always the same.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
…itialblockdownload.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
We have to add a send_and_mine_block() for cases where we want to get
a txid and then mine it (for canned blocks, we mine it then figure out
which tx it was!).

And fix up out-by-one in saving blocks.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
@rustyrussell rustyrussell merged commit b4eda94 into ElementsProject:master Nov 13, 2025
35 of 39 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.

1 participant