Writing Skills
writing-skills
效率与协作技能,来自 obra/superpowers,查看原文获取完整用途和操作说明。
lightning-pinning-attacks【部署与运维】Pinning attacks: low-fee descendant txs block honest fee-bumping by exploiting mempool descendant policy. Anchor outputs (BOLT-3), TRUC v3 (BIP431), P2A + ephemeral dust, and the single shared anchor of `zero_fee_commitments` as defenses. USE WHEN: auditing fee-bump robustness, evaluating channel security, reviewing post-2024 LN deployments.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
zero_fee_commitments as defenses.
USE WHEN: auditing fee-bump robustness, evaluating channel security,
reviewing post-2024 LN deployments.
allowed-tools: Read, Grep, GlobPinning = an attacker publishes a tx that blocks your tx from confirming by attaching as a descendant chain that exhausts mempool descendant limits or replacement-fee budgets.
You publish parent P (commitment, HTLC-timeout, etc.). Attacker publishes child C spending P's output:
Result: your honest tx P is "stuck" until mempool eviction (which might never happen if attacker keeps refilling).
In Lightning context:
option_anchors, BOLT-3, ~2020)Each commitment tx gets two 330-sat anchor outputs, one keyed to each party's funding key:
You can spend your anchor with a high-fee child to CPFP the commitment. Defeats simple pinning of commitment. Two separate keyed anchors are what stops a peer from monopolising the descendant limit on a shared fee-bump output.
But: HTLC-timeout txs themselves still vulnerable. And because every
non-anchor output is CSV-locked under option_anchors, the anchor is
the only CPFP handle, so its child needs an external wallet UTXO.
OP_1 <0x4e73>, spent by
anyone with an empty witness. Standard output type since Core 28.0;
standard dust limit 240 sat."Ephemeral anchors" was the 2023 working name for this idea. What actually shipped is the P2A output type plus the ephemeral-dust rule, so prefer those terms. BIP431 and BIP433 are both still Status: Draft as of September 2026 — the policy shipped as standardness in Core, the BIPs themselves were never finalised.
Combined: pinning surface is removed. Attacker can't keep stacking descendants; honest party can sibling-evict bad children cheaply.
submitpackage (RPC, since Bitcoin Core 26.0, December 2023) lets you
submit parent + your CPFP child atomically to your own node. Mempool
computes effective package fee rate. No race against attacker.
Over the wire, Core 28.0 (October 2024) added opportunistic
1-parent-1-child (1p1c) relay, carried on the existing tx-relay
protocol. BIP331 "Ancestor Package Relay" is still Status: Draft and
has never been deployed — its sendpackages / ancpkginfo /
pkgtxns messages do not exist in the Bitcoin Core source tree as of
September 2026. Do not design around a negotiated package-relay
protocol on the wire; design around 1p1c plus local submitpackage.
zero_fee_commitments, 2026)Merged into the BOLT spec on 2026-05-04 (lightning/bolts PR #1228,
BOLT-9 feature bits 40/41). This replaces the anchor + update_fee
model rather than tuning it:
version is 3 (TRUC), so commitment + one child
form a TRUC package under TRUC's topology limits.feerate_per_kw is fixed at 0: commitment, HTLC-timeout and
HTLC-success all have base fee 0, and update_fee is never sent.shared_anchor:
the standard P2A script OP_1 <0x4e73>, spendable by anyone with an
empty witness. Its amount is the sum of trimmed outputs plus
rounded-down msat; below the 240-sat P2A dust limit that is legal
only under the ephemeral-dust rule, which applies precisely because
the parent pays no fee. Above 240 sat the anchor caps at 240 and the
remainder becomes a real mining fee.option_anchors, so here to_remote
is a plain P2WPKH. You can CPFP a remote commitment by spending
your own main-balance or HTLC output — no external wallet UTXO
needed.Anti-pinning consequence: a single keyless anchor is safe here only because of TRUC. With at most one unconfirmed descendant and sibling eviction, an attacker's child can always be replaced by a higher-feerate sibling, so there is nothing to monopolise — which is why the per-party keyed anchors of Mitigation 1 are no longer needed. Requires a relay path accepting v3/TRUC (Core 28.0+) and ephemeral dust (Core 29.0+).
option_anchors + TRUC v3 + P2A/ephemeral dust + 1p1c package
submission → robust against known pinning variants.zero_fee_commitments is the current end-state design, merged into
the BOLT spec but shipped in only two implementations so far (see
below).| Impl | TRUC v3 commitments (zero_fee_commitments) | Anchor CPFP |
|---|---|---|
LDK (lightning crate) | yes — shipped in 0.2 (2025-12-02) | yes |
| Eclair | yes — final form in v0.14.0 (2026-05-21); moved its Bitcoin Core dependency to v30.x for v3/TRUC + ephemeral dust | yes |
| LND | no — no zero_fee_commitments in the source tree (latest release v0.21.3-beta, 2026-09-02) | yes |
| CLN | no — no zero_fee_commitments in the source tree (latest release v26.06.7, 2026-08-28) | yes |
LDK's 0.2 release notes flag that 0FC channels currently only
interoperate with LDK peers and that feature signalling may still
change. Do not cite a 0.0.1xx LDK version as the floor: the
0.0.x series ended at 0.0.125 (2024-10-14) and was succeeded by 0.1.0
(2025-01-16).
zero_fee_commitments).shared_anchor — option_anchors
needs one anchor per party because descendant limits are shared;
zero_fee_commitments needs only one keyless P2A because TRUC caps
the parent at one evictable descendant.