Skip to content

bitcoin: count the witness script when weighing an anchors to_remote input - #57

Merged
kwsantiago merged 1 commit into
blake2b-unifiedfrom
wallet-to-remote-anchor-weight
Oct 19, 2026
Merged

kwsantiago merged 1 commit into
blake2b-unifiedfrom
wallet-to-remote-anchor-weight

Conversation

@kwsantiago

Copy link
Copy Markdown

The wallet weighs a p2wsh_from_close input as if its witness were only the signature, under a comment saying such outputs predate anchors. They are the opposite: the wallet only holds a P2WSH output from a close when it is an anchors channel's to_remote, spent with the signature and the witness script (<remote_pubkey> OP_CHECKSIGVERIFY <csv> OP_CHECKSEQUENCEVERIFY, 37 bytes, or up to 39 with a lease's lock). The estimate was short by that script, so a transaction spending one at the minimum feerate fell below the relay floor and failed to broadcast.

The input is now weighed with the script at its largest size. The new test spends such an output with withdraw at 253perkw: before the change bitcoind refuses it ("min relay fee not met, 145 < 154"), after it the transaction is accepted at or above the floor.

Changelog-None

@kwsantiago
kwsantiago merged commit 921d739 into blake2b-unified Oct 19, 2026
88 of 90 checks passed
@kwsantiago
kwsantiago deleted the wallet-to-remote-anchor-weight branch October 19, 2026 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant