lightningd: pass signed tx through to close callback.

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 <rusty@rustcorp.com.au>
Changelog-Fixed: JSON-RPC: `close` returns a `tx` field with witness data populated (i.e. signed).
Fixes: #6440
This commit is contained in:
Rusty Russell
2023-07-31 21:03:22 +09:30
parent d90a185188
commit e981a4f14a
6 changed files with 60 additions and 38 deletions

View File

@@ -8,11 +8,13 @@ struct channel;
struct lightningd;
struct peer_fd;
/* Resolve a close command for a channel that will be closed soon: returns
* the cmd_id of one, if any (allocated off ctx). */
const char *resolve_close_command(const tal_t *ctx,
struct lightningd *ld, struct channel *channel,
bool cooperative);
/* Find cmd_id for closing command, if any. */
const char *cmd_id_from_close_command(const tal_t *ctx,
struct lightningd *ld, struct channel *channel);
/* Resolve a close command for a channel that will be closed soon. */
void resolve_close_command(struct lightningd *ld, struct channel *channel,
bool cooperative, const struct bitcoin_tx *close_tx);
void peer_start_closingd(struct channel *channel,
struct peer_fd *peer_fd);