Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Channel close prints invalid tx to console #6440

Closed
wtogami opened this issue Jul 25, 2023 · 0 comments
Closed

Channel close prints invalid tx to console #6440

wtogami opened this issue Jul 25, 2023 · 0 comments
Labels
Milestone

Comments

@wtogami
Copy link
Contributor

wtogami commented Jul 25, 2023

Blockstream Store lightning-cli close 712394x2573x1 1 prints this to console:

{
   "tx": "020000000138f56a69a06467c3fedb78dd920f510ec07a940cdd87489028a1155e090f1ef301000000008c3371800266d200000000000022002003d2d0c31b140608f6d071ec237f99708f96412bf9729554dea53ac47f6712e49f38020000000000160014ada0c8ab3345bc0b7e3218675b9c19084664430d47ea4120",
   "txid": "cf97e30a7b8f66e3a9574b2511a1a30ebb274c5fed57e8ac58246b1dc63c04ee",
   "type": "unilateral"
}

The complete tx is transmitted but invalid tx where the witness is missing is printed to console.

$ bitcoin-cli sendrawtransaction "020000000138f56a69a06467c3fedb78dd920f510ec07a940cdd87489028a1155e090f1ef301000000008c3371800266d200000000000022002003d2d0c31b140608f6d071ec237f99708f96412bf9729554dea53ac47f6712e49f38020000000000160014ada0c8ab3345bc0b7e3218675b9c19084664430d47ea4120"
error code: -26
error message:
non-mandatory-script-verify-flag (Witness program was passed an empty witness)
@rustyrussell rustyrussell added this to the v23.08 milestone Jul 30, 2023
rustyrussell added a commit to rustyrussell/lightning that referenced this issue Jul 31, 2023
We don't actually sign in place, since ->last_tx is assumed unsigned,
and I'd have to audit carefully to change that.  But we can thread the
signed tx through so close's JSON return contains that, rather than the
unsigned channel->last_tx.

We have to split the "get cmd_id" from "resolve the close commands" though;
and of course, as before, we don't actually print the txids of multiple
transactions even though we may have multi in flight due to splice!

Signed-off-by: Rusty Russell <[email protected]>
Changelog-Fixed: JSON-RPC: `close` returns a `tx` field with witness data populated (i.e. signed).
Fixes: ElementsProject#6440
rustyrussell added a commit to rustyrussell/lightning that referenced this issue Jul 31, 2023
Thread the signed tx through so close's JSON return contains that,
rather than the unsigned channel->last_tx.

We have to split the "get cmd_id" from "resolve the close commands" though;
and of course, as before, we don't actually print the txids of multiple
transactions even though we may have multi in flight due to splice!

Signed-off-by: Rusty Russell <[email protected]>
Changelog-Fixed: JSON-RPC: `close` returns a `tx` field with witness data populated (i.e. signed).
Fixes: ElementsProject#6440
rustyrussell added a commit to rustyrussell/lightning that referenced this issue Jul 31, 2023
Thread the signed tx through so close's JSON return contains that,
rather than the unsigned channel->last_tx.

We have to split the "get cmd_id" from "resolve the close commands" though;
and of course, as before, we don't actually print the txids of multiple
transactions even though we may have multi in flight due to splice!

Signed-off-by: Rusty Russell <[email protected]>
Changelog-Fixed: JSON-RPC: `close` returns a `tx` field with witness data populated (i.e. signed).
Fixes: ElementsProject#6440
rustyrussell added a commit to rustyrussell/lightning that referenced this issue Jul 31, 2023
Thread the signed tx through so close's JSON return contains that,
rather than the unsigned channel->last_tx.

We have to split the "get cmd_id" from "resolve the close commands" though;
and of course, as before, we don't actually print the txids of multiple
transactions even though we may have multi in flight due to splice!

Signed-off-by: Rusty Russell <[email protected]>
Changelog-Fixed: JSON-RPC: `close` returns a `tx` field with witness data populated (i.e. signed).
Fixes: ElementsProject#6440
litch pushed a commit to litch/lightning that referenced this issue Aug 11, 2023
Thread the signed tx through so close's JSON return contains that,
rather than the unsigned channel->last_tx.

We have to split the "get cmd_id" from "resolve the close commands" though;
and of course, as before, we don't actually print the txids of multiple
transactions even though we may have multi in flight due to splice!

Signed-off-by: Rusty Russell <[email protected]>
Changelog-Fixed: JSON-RPC: `close` returns a `tx` field with witness data populated (i.e. signed).
Fixes: ElementsProject#6440
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants