Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions channeld/channeld.c
Original file line number Diff line number Diff line change
Expand Up @@ -2782,6 +2782,22 @@ static void handle_peer_fail_malformed_htlc(struct peer *peer, const u8 *msg)
abort();
}

/* These messages are handled by simpleclosed, not channeld. They should
* never arrive here: if option_simple_close is negotiated, master starts
* simpleclosed (not closingd) after channeld sends shutdown_complete, so
* only simpleclosed talks to the peer at that point. */
static void handle_peer_closing_complete(struct peer *peer, const u8 *msg)
{
peer_failed_warn(peer->pps, &peer->channel_id,
"Unexpected closing_complete in channeld");
}

static void handle_peer_closing_sig(struct peer *peer, const u8 *msg)
{
peer_failed_warn(peer->pps, &peer->channel_id,
"Unexpected closing_sig in channeld");
}

static void handle_peer_shutdown(struct peer *peer, const u8 *shutdown)
{
struct channel_id channel_id;
Expand Down Expand Up @@ -5202,14 +5218,18 @@ static void peer_in(struct peer *peer, const u8 *msg)
case WIRE_TX_ABORT:
check_tx_abort(peer, msg, NULL);
return;
case WIRE_CLOSING_COMPLETE:
handle_peer_closing_complete(peer, msg);
return;
case WIRE_CLOSING_SIG:
handle_peer_closing_sig(peer, msg);
return;
case WIRE_INIT:
case WIRE_OPEN_CHANNEL:
case WIRE_ACCEPT_CHANNEL:
case WIRE_FUNDING_CREATED:
case WIRE_FUNDING_SIGNED:
case WIRE_CLOSING_SIGNED:
case WIRE_CLOSING_COMPLETE:
case WIRE_CLOSING_SIG:
case WIRE_TX_ADD_INPUT:
case WIRE_TX_REMOVE_INPUT:
case WIRE_TX_ADD_OUTPUT:
Expand Down
21 changes: 16 additions & 5 deletions closingd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,26 @@ CLOSINGD_SRC := closingd/closingd.c \
CLOSINGD_OBJS := $(CLOSINGD_SRC:.c=.o)
$(CLOSINGD_OBJS): $(CLOSINGD_HEADERS)

# Simple close daemon
SIMPLECLOSED_HEADERS := closingd/simpleclosed_wiregen.h

SIMPLECLOSED_SRC := closingd/simpleclosed.c \
$(SIMPLECLOSED_HEADERS:.h=.c)

SIMPLECLOSED_OBJS := $(SIMPLECLOSED_SRC:.c=.o)
$(SIMPLECLOSED_OBJS): $(SIMPLECLOSED_HEADERS)

# Make sure these depend on everything.
ALL_C_SOURCES += $(CLOSINGD_SRC)
ALL_C_HEADERS += $(CLOSINGD_HEADERS)
ALL_PROGRAMS += lightningd/lightning_closingd
ALL_C_SOURCES += $(CLOSINGD_SRC) $(SIMPLECLOSED_SRC)
ALL_C_HEADERS += $(CLOSINGD_HEADERS) $(SIMPLECLOSED_HEADERS)
ALL_PROGRAMS += lightningd/lightning_closingd lightningd/lightning_simpleclosed

# Here's what lightningd depends on
LIGHTNINGD_CONTROL_HEADERS += closingd/closingd_wiregen.h
LIGHTNINGD_CONTROL_OBJS += closingd/closingd_wiregen.o
LIGHTNINGD_CONTROL_HEADERS += closingd/closingd_wiregen.h closingd/simpleclosed_wiregen.h
LIGHTNINGD_CONTROL_OBJS += closingd/closingd_wiregen.o closingd/simpleclosed_wiregen.o

lightningd/lightning_closingd: $(CLOSINGD_OBJS) $(HSMD_CLIENT_OBJS) libcommon.a

lightningd/lightning_simpleclosed: $(SIMPLECLOSED_OBJS) $(HSMD_CLIENT_OBJS) libcommon.a

-include closingd/test/Makefile
Loading
Loading