Nits from PR review (comment improvements)
What changed, and why it matters
This commit only changes code comments to make them clearer and more concise. No actual program logic, checks, or behavior were modified. It is not a security fix.
No action needed; this is a documentation-only change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff updates two comments in C source files. In wallet.c, a comment is added describing tr policy nodes. In policy.c, a lengthy comment about older() node validation is shortened and a more detailed explanation is moved to the is_policy_sane() function. The validation callback and all surrounding code remain unchanged.
Changed components
src/common/wallet.csrc/handler/lib/policy.cInspect captured patch +8 / −5
diff --git a/src/common/wallet.c b/src/common/wallet.c
index 2cf63bf..6fc2fef 100644
--- a/src/common/wallet.c
+++ b/src/common/wallet.c
@@ -3009,6 +3009,7 @@ int traverse_policy_dfs(const policy_node_t *policy_node,
return 0;
}
+ // tr nodes with a keypath and (possibly) a taptree
case TOKEN_TR: {
const policy_node_tr_t *node = (const policy_node_tr_t *) policy_node;
if (!isnull_policy_node_tree(&node->tree)) {
diff --git a/src/handler/lib/policy.c b/src/handler/lib/policy.c
index 1e10826..cce9b24 100644
--- a/src/handler/lib/policy.c
+++ b/src/handler/lib/policy.c
@@ -1946,11 +1946,8 @@ static bool are_key_placeholders_identical(const policy_node_keyexpr_t *kp1,
}
/**
- * Callback for traverse_policy_dfs that rejects any TOKEN_OLDER node whose argument is not either:
- * - between 1 and 65535 (inclusive), if bit 22 is cleared (block-based relative timelock)
- * - between 1 + 2^22 = 4194305 and 65535 + 2^22 = 4259839 (inclusive), if bit 22 is set (time-based
- * relative timelock) This forces all the bits that have no consensus meaning per BIP-68/BIP-112 to
- * be zero.
+ * Callback for traverse_policy_dfs that rejects older(n) nodes with an argument that is not
+ * safe, as it sets bits with no consensus meaning (see comment in is_policy_sane() below).
*/
static int check_older_node_cb(const policy_node_t *node, void *callback_state) {
(void) callback_state;
@@ -2097,6 +2094,11 @@ int is_policy_sane(dispatcher_context_t *dispatcher_context,
// - between 1 + 2^22 = 4194305 and 65535 + 2^22 = 4259839 (inclusive), if bit 22 is set
// (time-based timelock)
//
+ // Bit 22 is SEQUENCE_LOCKTIME_TYPE_FLAG in BIP-68.
+ // Note that bit 31 (SEQUENCE_LOCKTIME_DISABLE_FLAG) is implicitly excluded, as the argument n
+ // of older(n) is guaranteed to be strictly less than 2^31 per miniscript rules, which are
+ // enforced in the policy parser.
+ //
// See also: https://github.com/bitcoin/bitcoin/pull/33135
if (0 > traverse_policy_dfs(policy, check_older_node_cb, NULL)) {
return WITH_ERROR(-1, "older() argument out of valid range");
Why this scored 15/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.