mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-05 23:24:21 +01:00
channeld: don't exchange my_current_per_commitment_point if option_static_remotekey
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
neil saitug
parent
ee3480e56b
commit
0861279b65
@@ -1,5 +1,6 @@
|
||||
#include <bitcoin/pubkey.h>
|
||||
#include <bitcoin/script.h>
|
||||
#include <ccan/cast/cast.h>
|
||||
#include <channeld/gen_channel_wire.h>
|
||||
#include <common/features.h>
|
||||
#include <common/memleak.h>
|
||||
@@ -183,17 +184,29 @@ static void peer_got_shutdown(struct channel *channel, const u8 *msg)
|
||||
|
||||
static void channel_fail_fallen_behind(struct channel *channel, const u8 *msg)
|
||||
{
|
||||
struct pubkey per_commitment_point;
|
||||
|
||||
if (!fromwire_channel_fail_fallen_behind(msg, &per_commitment_point)) {
|
||||
if (!fromwire_channel_fail_fallen_behind(channel, msg,
|
||||
cast_const2(struct pubkey **,
|
||||
&channel->future_per_commitment_point))) {
|
||||
channel_internal_error(channel,
|
||||
"bad channel_fail_fallen_behind %s",
|
||||
tal_hex(tmpctx, msg));
|
||||
return;
|
||||
}
|
||||
|
||||
channel->future_per_commitment_point
|
||||
= tal_dup(channel, struct pubkey, &per_commitment_point);
|
||||
/* per_commitment_point is NULL if option_static_remotekey, but we
|
||||
* use its presence as a flag so set it any valid key in that case. */
|
||||
if (!channel->future_per_commitment_point) {
|
||||
struct pubkey *any = tal(channel, struct pubkey);
|
||||
if (!channel->option_static_remotekey) {
|
||||
channel_internal_error(channel,
|
||||
"bad channel_fail_fallen_behind %s",
|
||||
tal_hex(tmpctx, msg));
|
||||
return;
|
||||
}
|
||||
if (!pubkey_from_node_id(any, &channel->peer->ld->id))
|
||||
fatal("Our own id invalid?");
|
||||
channel->future_per_commitment_point = any;
|
||||
}
|
||||
|
||||
/* Peer sees this, so send a generic msg about unilateral close. */
|
||||
channel_fail_permanent(channel, "Awaiting unilateral close");
|
||||
|
||||
Reference in New Issue
Block a user