common: remove tal_check() call on libwally allocations.
What changed, and why it matters
This change removes a repeated internal sanity check that was making very large Bitcoin transaction templates (PSBTs with hundreds of inputs) extremely slow to process. It is a performance fix, not a security fix. The remaining single check at the end still catches the same class of problems, just less frequently.
No immediate security action required. Treat as a routine performance optimization. If desired, verify that tal_check() is indeed still invoked at a higher level after PSBT operations complete, preserving the intended debugging safety net.
Security signals we found
Removal of a defensive runtime integrity assertion
Performance regression with large PSBT workloads
No memory-safety semantic change: allocation path and error handling remain identical
Evidence from the diff
The commit removes an assert(tal_check(…)) call inside cln_wally_tal(), the libwally allocation wrapper. tal_check() validates the tal allocation tree. Calling it on every libwally allocation caused O(n^2)-style overhead when libwally allocated many small objects while building large PSBTs. The commit message states tal_check() is still called once at the end, so the integrity validation is retained but amortized. The diff only deletes one assertion line.
Changed components
common/setup.clibwally allocation wrapper (cln_wally_tal)PSBT handling via JSON-RPCInspect captured patch +0 / −1
diff --git a/common/setup.c b/common/setup.c
index 56ff682..8db367e 100644
--- a/common/setup.c
+++ b/common/setup.c
@@ -11,7 +11,6 @@
static void *cln_wally_tal(size_t size)
{
assert(wally_tal_ctx);
- assert(tal_check(wally_tal_ctx, "cln_wally_tal ctx check"));
return tal_arr_label(wally_tal_ctx, u8, size, "cln_wally_tal");
}
Why this scored 19/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.