[v0.20.x-branch] Backport #10869: contractcourt: fix HTLC success resolver phantom-input bug (#10840) - #11088
[v0.20.x-branch] Backport #10869: contractcourt: fix HTLC success resolver phantom-input bug (#10840)#11088github-actions[bot] wants to merge 11 commits into
Conversation
|
Please cherry-pick the changes locally and resolve any conflicts. git fetch origin backport-10869-to-v0.20.x-branch
git worktree add --checkout .worktree/backport-10869-to-v0.20.x-branch backport-10869-to-v0.20.x-branch
cd .worktree/backport-10869-to-v0.20.x-branch
git reset --hard HEAD^
git cherry-pick -x e9d88431e37ceb6d76889ff3de86f52621a525d6 5266bc0e26f0eda3565b3d65c08ff56dd46ebc1b 6267d18000566937968cf7a5a022e1bfc3e9e226 b9a3f844ea461f35fe1cff8e276ddd9de164a494 dd24c85c52598befbbbd0cd1ef1bccab04c434ca 96a123961b7088125f89667bc7b170eaff307d76 594581f441e1480a2d66576e9492ae793240cbee b8d2012357b059a8bc4fc47c69a07b45c8363893 5fd79d6a7027b1a9024ad1350167f87b7f87a627 eed8a05a3bd0dd78000c1f490ee07f5cf1220d13 faafbd091ea66ddf013c5e2c6901c2f198cb3f48 1f6a385f783120add6a67b32b671bd8e777efe4e
git push --force-with-lease |
Spend notifications cross an internal boundary, so validate the selected transaction input before callers inspect it. Add focused coverage for missing metadata, invalid indices, nil inputs, and unexpected outpoints. (cherry picked from commit e9d8843)
Taproot leaf identity includes both the script and its leaf version. An auxiliary leaf may reuse the success script under another version. Normalize BIP341 annexes in the input package so success-spend classification can share the exact predicate. Cover annex boundaries and same-script auxiliary leaves. (cherry picked from commit 5266bc0)
Taproot spenders can append a BIP341 annex without changing the spend path. Normalize timeout and revocation witness stacks before matching their shapes. This keeps annexed key and script path spends classified the same as their plain forms. (cherry picked from commit 6267d18)
Timeout cleanup extracts a preimage from a success-shaped witness before updating the cache and settling the incoming link. Verify that the revealed preimage opens the resolver HTLC. Update fixtures to use matching preimages and cover a mismatched success-shaped witness. (cherry picked from commit b9a3f84)
A re-signed success transaction can move its committed output to another index while preserving the HTLC input signature. Match the indexed output against the sweep descriptor and return the confirmed outpoint. Keep malformed resolver and notifier state distinct from complete non-matches. (cherry picked from commit dd24c85)
A foreign transaction can consume the commitment HTLC without leaving a second-level success output for this resolver. Checkpoint a failed terminal outcome while the resolver is unresolved. Roll back live report and incubation state on persistence errors. Retain keyed notification coverage for a successful retry. (cherry picked from commit 96a1239)
A direct commitment outpoint can confirm through the success, timeout, or an auxiliary Taproot path after the resolver offers its own sweep. Validate the notifier input and expected success leaf before reading the preimage. Checkpoint other complete paths as failed. Treat a wrong preimage on the expected leaf as malformed state. (cherry picked from commit 594581f)
Sweeper aggregation can replace the pre-signed success transaction and move its committed output to another index. Report the confirmed claim outpoint and transaction in both resolver stages. Use keyed notifier fixtures and distinct transaction IDs to cover the terminal outcome directly. (cherry picked from commit b8d2012)
Launch may replay a historical commitment spend before Resolve owns the terminal transition. Validate the selected input and match the confirmed second-level output before offering it. Leave complete non-matches for Resolve instead of creating a phantom sweep input. (cherry picked from commit 5fd79d6)
Resolve owns terminal checkpointing for historical commitment spends. A complete non-match is a failed outcome. Malformed spend or resolver state must stop without persisting a terminal transition. Derive the confirmed second-level outpoint from the validated transaction. Cover fresh, restored, and malformed spend paths. (cherry picked from commit eed8a05)
Add the foreign commitment spend fix to the 0.20.4 release notes. Credit the contributor alongside the release entry. (cherry picked from commit 1f6a385)
e630f3f to
e935c92
Compare
Backport notes for reviewersThis branch was rebuilt from Master's 12th commit ( What differs from master, commit by commit
5 of 11 commits are byte-identical to their master counterparts. The other 6 Reason 1: btcd module paths (1 line)Master has moved to the btcd v2 module split ( Reason 2:
|
🔴 PR Severity: CRITICAL
🔴 Critical (3 files)
🟢 Low (1 file, plus test-only changes not counted above)
AnalysisThis is a backport of #10869 to To override, add a |
Backport of #10869
Part of #10840.
Summary
Ordered incoming HTLC expiry follow-up: #10990.
Delayed missing-input batch isolation is implemented in #10842.
Testing
go test ./contractcourtgo test -race ./contractcourtgo vet ./contractcourtmake lint-sourcegit diff d7d2aad11d612022c70c776b01a003f989b61c60..HEAD --check