mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 14:42:40 +01:00
channel_control: when we reach depth, for v2 channels, tell dualopend
This commit is contained in:
parent
1c9a713dfa
commit
57348e0470
2 changed files with 29 additions and 9 deletions
|
@ -56,6 +56,10 @@ LIGHTNINGD_HEADERS := \
|
||||||
lightningd/channel_state.h \
|
lightningd/channel_state.h \
|
||||||
lightningd/channel_state_names_gen.h
|
lightningd/channel_state_names_gen.h
|
||||||
|
|
||||||
|
ifeq ($(EXPERIMENTAL_FEATURES),1)
|
||||||
|
LIGHTNINGD_HEADERS += lightningd/dual_open_control.h
|
||||||
|
endif
|
||||||
|
|
||||||
LIGHTNINGD_OBJS := $(LIGHTNINGD_SRC:.c=.o) $(LIGHTNINGD_SRC_NOHDR:.c=.o)
|
LIGHTNINGD_OBJS := $(LIGHTNINGD_SRC:.c=.o) $(LIGHTNINGD_SRC_NOHDR:.c=.o)
|
||||||
$(LIGHTNINGD_OBJS): $(LIGHTNINGD_HEADERS) $(LIGHTNINGD_CONTROL_HEADERS)
|
$(LIGHTNINGD_OBJS): $(LIGHTNINGD_HEADERS) $(LIGHTNINGD_CONTROL_HEADERS)
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,10 @@
|
||||||
#include <wire/common_wiregen.h>
|
#include <wire/common_wiregen.h>
|
||||||
#include <wire/wire_sync.h>
|
#include <wire/wire_sync.h>
|
||||||
|
|
||||||
|
#if EXPERIMENTAL_FEATURES
|
||||||
|
#include <lightningd/dual_open_control.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
static void update_feerates(struct lightningd *ld, struct channel *channel)
|
static void update_feerates(struct lightningd *ld, struct channel *channel)
|
||||||
{
|
{
|
||||||
u8 *msg;
|
u8 *msg;
|
||||||
|
@ -610,15 +614,6 @@ bool channel_tell_depth(struct lightningd *ld,
|
||||||
|
|
||||||
txidstr = type_to_string(tmpctx, struct bitcoin_txid, txid);
|
txidstr = type_to_string(tmpctx, struct bitcoin_txid, txid);
|
||||||
|
|
||||||
/* If not awaiting lockin/announce, it doesn't care any more */
|
|
||||||
if (channel->state != CHANNELD_AWAITING_LOCKIN
|
|
||||||
&& channel->state != CHANNELD_NORMAL) {
|
|
||||||
log_debug(channel->log,
|
|
||||||
"Funding tx %s confirmed, but peer in state %s",
|
|
||||||
txidstr, channel_state_name(channel));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!channel->owner) {
|
if (!channel->owner) {
|
||||||
log_debug(channel->log,
|
log_debug(channel->log,
|
||||||
"Funding tx %s confirmed, but peer disconnected",
|
"Funding tx %s confirmed, but peer disconnected",
|
||||||
|
@ -626,6 +621,27 @@ bool channel_tell_depth(struct lightningd *ld,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (streq(channel->owner->name, "dualopend")) {
|
||||||
|
if (channel->state != DUALOPEND_AWAITING_LOCKIN
|
||||||
|
&& channel->state != CHANNELD_NORMAL) {
|
||||||
|
log_debug(channel->log,
|
||||||
|
"Funding tx %s confirmed, but peer in"
|
||||||
|
" state %s",
|
||||||
|
txidstr, channel_state_name(channel));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// FIXME: pass to dualopend here!
|
||||||
|
} else if (channel->state != CHANNELD_AWAITING_LOCKIN
|
||||||
|
&& channel->state != CHANNELD_NORMAL) {
|
||||||
|
/* If not awaiting lockin/announce, it doesn't
|
||||||
|
* care any more */
|
||||||
|
log_debug(channel->log,
|
||||||
|
"Funding tx %s confirmed, but peer in state %s",
|
||||||
|
txidstr, channel_state_name(channel));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
subd_send_msg(channel->owner,
|
subd_send_msg(channel->owner,
|
||||||
take(towire_channeld_funding_depth(NULL, channel->scid,
|
take(towire_channeld_funding_depth(NULL, channel->scid,
|
||||||
depth)));
|
depth)));
|
||||||
|
|
Loading…
Add table
Reference in a new issue