Set current block locktime for coinbase in provide_anchor_reserves
What changed, and why it matters
This is a one-line change inside a test helper function. It sets the transaction locktime to the current block height instead of zero when creating a dummy coinbase transaction used only in tests. The goal is to avoid duplicate transaction IDs when the test framework rapidly mines blocks. It does not affect production Lightning node code or real funds.
No security action required. Treat as a normal test-maintenance commit. If reviewing, confirm the locktime height matches the node's best block and that tests pass deterministically.
Security signals we found
Transaction ID uniqueness fix in test helper
Test-only code path (functional_test_utils.rs)
No production consensus or wallet logic modified
Evidence from the diff
In lightning/src/ln/functional_test_utils.rs, the test-only helper provide_anchor_reserves constructs a fake coinbase transaction. The patch changes lock_time from LockTime::ZERO to LockTime::from_height(nodes[0].best_block_info().1).unwrap(). Because the test harness mines the created transaction immediately and advances the chain, successive calls now produce distinct txids, preventing collisions in test state. The change is confined to test utilities and has no runtime security boundary.
Changed components
lightning/src/ln/functional_test_utils.rstest helper: provide_anchor_reservesInspect captured patch +1 / −1
diff --git a/lightning/src/ln/functional_test_utils.rs b/lightning/src/ln/functional_test_utils.rs
index 2bc8049..bd5d353 100644
--- a/lightning/src/ln/functional_test_utils.rs
+++ b/lightning/src/ln/functional_test_utils.rs
@@ -409,7 +409,7 @@ pub fn provide_anchor_reserves<'a, 'b, 'c>(nodes: &[Node<'a, 'b, 'c>]) -> Transa
}
let tx = Transaction {
version: TxVersion::TWO,
- lock_time: LockTime::ZERO,
+ lock_time: LockTime::from_height(nodes[0].best_block_info().1).unwrap(),
input: vec![TxIn { ..Default::default() }],
output,
};
Why this scored 16/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.