mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-07 16:14:26 +01:00
connectd: check for supported features ourselves.
Checking in the master doesn't help anything, and it's weird. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> 1diff --git a/connectd/connect.c b/connectd/connect.c index 138b73fc..b01d1546 100644
This commit is contained in:
@@ -562,6 +562,26 @@ static struct io_plan *peer_init_received(struct io_conn *conn,
|
||||
return io_close(conn);
|
||||
}
|
||||
|
||||
if (!features_supported(peer->gfeatures, peer->lfeatures)) {
|
||||
const u8 *global_features = get_offered_global_features(msg);
|
||||
const u8 *local_features = get_offered_local_features(msg);
|
||||
msg = towire_errorfmt(NULL, NULL, "Unsupported features %s/%s:"
|
||||
" we only offer globalfeatures %s"
|
||||
" and localfeatures %s",
|
||||
tal_hex(msg, peer->gfeatures),
|
||||
tal_hex(msg, peer->lfeatures),
|
||||
tal_hexstr(msg,
|
||||
global_features,
|
||||
tal_count(global_features)),
|
||||
tal_hexstr(msg,
|
||||
local_features,
|
||||
tal_count(local_features)));
|
||||
queue_peer_msg(peer, take(msg));
|
||||
|
||||
/* Don't read any more */
|
||||
return io_wait(conn, peer, io_never, peer);
|
||||
}
|
||||
|
||||
return peer_connected(conn, peer);
|
||||
}
|
||||
|
||||
|
||||
@@ -445,8 +445,6 @@ void peer_connected(struct lightningd *ld, const u8 *msg,
|
||||
struct crypto_state cs;
|
||||
u8 *gfeatures, *lfeatures;
|
||||
u8 *error;
|
||||
u8 *global_features;
|
||||
u8 *local_features;
|
||||
struct channel *channel;
|
||||
struct wireaddr_internal addr;
|
||||
struct uncommitted_channel *uc;
|
||||
@@ -457,25 +455,6 @@ void peer_connected(struct lightningd *ld, const u8 *msg,
|
||||
fatal("Connectd gave bad CONNECT_PEER_CONNECTED message %s",
|
||||
tal_hex(msg, msg));
|
||||
|
||||
if (!features_supported(gfeatures, lfeatures)) {
|
||||
log_unusual(ld->log, "peer %s offers unsupported features %s/%s",
|
||||
type_to_string(msg, struct pubkey, &id),
|
||||
tal_hex(msg, gfeatures),
|
||||
tal_hex(msg, lfeatures));
|
||||
global_features = get_offered_global_features(msg);
|
||||
local_features = get_offered_local_features(msg);
|
||||
error = towire_errorfmt(msg, NULL,
|
||||
"We only offer globalfeatures %s"
|
||||
" and localfeatures %s",
|
||||
tal_hexstr(msg,
|
||||
global_features,
|
||||
tal_count(global_features)),
|
||||
tal_hexstr(msg,
|
||||
local_features,
|
||||
tal_count(local_features)));
|
||||
goto send_error;
|
||||
}
|
||||
|
||||
/* Were we trying to open a channel, and we've raced? */
|
||||
if (handle_opening_channel(ld, &id, &addr, &cs,
|
||||
gfeatures, lfeatures, peer_fd, gossip_fd))
|
||||
|
||||
Reference in New Issue
Block a user