mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 06:41:44 +01:00
common: remove channel_id check.
connectd demuxes for us, so this can never trigger. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
821d5f48ea
commit
aca2aa9ae6
4 changed files with 0 additions and 65 deletions
|
@ -56,18 +56,6 @@ bool is_peer_error(const tal_t *ctx, const u8 *msg,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool is_wrong_channel(const u8 *msg, const struct channel_id *expected,
|
||||
struct channel_id *actual)
|
||||
{
|
||||
if (!expected)
|
||||
return false;
|
||||
|
||||
if (!extract_channel_id(msg, actual))
|
||||
return false;
|
||||
|
||||
return !channel_id_eq(expected, actual);
|
||||
}
|
||||
|
||||
bool handle_peer_error(struct per_peer_state *pps,
|
||||
const struct channel_id *channel_id,
|
||||
const u8 *msg TAKES)
|
||||
|
|
|
@ -23,18 +23,6 @@ bool is_peer_error(const tal_t *ctx, const u8 *msg,
|
|||
const struct channel_id *channel_id,
|
||||
char **desc, bool *warning);
|
||||
|
||||
/**
|
||||
* is_wrong_channel - if it's a message about a different channel, return true
|
||||
* @msg: the peer message.
|
||||
* @channel_id: the channel id of the current channel.
|
||||
* @actual: set to the actual channel id if this returns false.
|
||||
*
|
||||
* Note that this only handles some message types, returning false for others.
|
||||
*/
|
||||
bool is_wrong_channel(const u8 *msg, const struct channel_id *expected,
|
||||
struct channel_id *actual);
|
||||
|
||||
|
||||
/**
|
||||
* handle_peer_error - simple handler for errors
|
||||
* @pps: per-peer state.
|
||||
|
|
|
@ -1291,7 +1291,6 @@ static u8 *opening_negotiate_msg(const tal_t *ctx, struct state *state)
|
|||
u8 *msg;
|
||||
char *err;
|
||||
bool warning;
|
||||
struct channel_id actual;
|
||||
enum peer_wire t;
|
||||
|
||||
/* The event loop is responsible for freeing tmpctx, so our
|
||||
|
@ -1331,25 +1330,6 @@ static u8 *opening_negotiate_msg(const tal_t *ctx, struct state *state)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/*~ We do not support multiple "live" channels, though the
|
||||
* protocol has a "channel_id" field in all non-gossip messages
|
||||
* so it's possible. Our one-process-one-channel mechanism
|
||||
* keeps things simple: if we wanted to change this, we would
|
||||
* probably be best with another daemon to de-multiplex them;
|
||||
* this could be connectd itself, in fact. */
|
||||
if (is_wrong_channel(msg, &state->channel_id, &actual)) {
|
||||
status_debug("Rejecting %s for unknown channel_id %s",
|
||||
peer_wire_name(fromwire_peektype(msg)),
|
||||
type_to_string(tmpctx, struct channel_id,
|
||||
&actual));
|
||||
peer_write(state->pps,
|
||||
take(towire_errorfmt(NULL, &actual,
|
||||
"Multiple channels"
|
||||
" unsupported")));
|
||||
tal_free(msg);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* In theory, we're in the middle of an open/RBF, but
|
||||
* it's possible we can get some different messages in
|
||||
* the meantime! */
|
||||
|
|
|
@ -187,7 +187,6 @@ static u8 *opening_negotiate_msg(const tal_t *ctx, struct state *state,
|
|||
u8 *msg;
|
||||
char *err;
|
||||
bool warning;
|
||||
struct channel_id actual;
|
||||
|
||||
/* The event loop is responsible for freeing tmpctx, so our
|
||||
* temporary allocations don't grow unbounded. */
|
||||
|
@ -226,26 +225,6 @@ static u8 *opening_negotiate_msg(const tal_t *ctx, struct state *state,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/*~ We do not support multiple "live" channels, though the
|
||||
* protocol has a "channel_id" field in all non-gossip messages
|
||||
* so it's possible. Our one-process-one-channel mechanism
|
||||
* keeps things simple: if we wanted to change this, we would
|
||||
* probably be best with another daemon to de-multiplex them;
|
||||
* this could be connectd itself, in fact. */
|
||||
if (is_wrong_channel(msg, &state->channel_id, &actual)
|
||||
&& is_wrong_channel(msg, alternate, &actual)) {
|
||||
status_debug("Rejecting %s for unknown channel_id %s",
|
||||
peer_wire_name(fromwire_peektype(msg)),
|
||||
type_to_string(tmpctx, struct channel_id,
|
||||
&actual));
|
||||
peer_write(state->pps,
|
||||
take(towire_errorfmt(NULL, &actual,
|
||||
"Multiple channels"
|
||||
" unsupported")));
|
||||
tal_free(msg);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* If we get here, it's an interesting message. */
|
||||
return msg;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue