pytest: fix feerate check in test_peer_anchor_push
What changed, and why it matters
This commit fixes a test-only logging issue. A developer warning flag (dev_warn_on_overgrind) was not logging when an anchor transaction signature was shorter than expected, causing a pytest test to fail its feerate assertion. The fix adds a log message so the test can detect the short signature and skip the strict feerate check. There is no production security vulnerability here.
No security action required. Treat as normal test reliability fix. If reviewing, confirm dev_warn_on_overgrind is a developer-only flag and not enabled in production builds.
Security signals we found
No cryptographic weakness introduced or fixed
No privilege boundary crossed
No input validation change
Test-only diagnostic logging change
Signature length check is informational only
Evidence from the diff
The change adds a conditional log in hsmd/libhsmd.c’s handle_sign_anchorspend() that emits a LOG_BROKEN message when dev_warn_on_overgrind is enabled and the produced anchor spend signature is shorter than 71 bytes. This log is consumed by the test helper did_short_sig() in tests/test_closing.py. Without the log, did_short_sig() returns false, so check_feerate() enforces the stricter upper bound and fails when the actual feerate is slightly above expected due to the smaller signature reducing transaction weight. The fix is purely diagnostic/test-infrastructure; the signature itself remains valid.
Changed components
hsmd/libhsmd.chandle_sign_anchorspend()tests/test_closing.py::test_peer_anchor_pushInspect captured patch +7 / −0
diff --git a/hsmd/libhsmd.c b/hsmd/libhsmd.c
index e4a14e4..dd23292 100644
--- a/hsmd/libhsmd.c
+++ b/hsmd/libhsmd.c
@@ -1820,6 +1820,13 @@ static u8 *handle_sign_anchorspend(struct hsmd_client *c, const u8 *msg_in)
fmt_pubkey(tmpctx, &local_funding_pubkey),
fmt_wally_psbt(tmpctx, psbt));
}
+ if (dev_warn_on_overgrind
+ && psbt->inputs[0].signatures.num_items == 1
+ && psbt->inputs[0].signatures.items[0].value_len < 71) {
+ hsmd_status_fmt(LOG_BROKEN, NULL,
+ "overgrind: short signature length %zu",
+ psbt->inputs[0].signatures.items[0].value_len);
+ }
return towire_hsmd_sign_anchorspend_reply(NULL, psbt);
}
Why this scored 17/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.