mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
gossipd: local_add_channel can just use get_channel()
Also upgrade the status messages in the weird cases. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
6bc634badf
commit
a79879637a
@ -772,20 +772,19 @@ static void handle_local_add_channel(struct peer *peer, u8 *msg)
|
|||||||
msg, &scid, &chain_hash, &remote_node_id,
|
msg, &scid, &chain_hash, &remote_node_id,
|
||||||
&cltv_expiry_delta, &htlc_minimum_msat, &fee_base_msat,
|
&cltv_expiry_delta, &htlc_minimum_msat, &fee_base_msat,
|
||||||
&fee_proportional_millionths)) {
|
&fee_proportional_millionths)) {
|
||||||
status_trace("Unable to parse local_add_channel message: %s", tal_hex(msg, msg));
|
status_broken("Unable to parse local_add_channel message: %s", tal_hex(msg, msg));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!structeq(&chain_hash, &rstate->chain_hash)) {
|
if (!structeq(&chain_hash, &rstate->chain_hash)) {
|
||||||
status_trace("Received channel_announcement for unknown chain %s",
|
status_broken("Received local_add_channel for unknown chain %s",
|
||||||
type_to_string(msg, struct bitcoin_blkid,
|
type_to_string(msg, struct bitcoin_blkid,
|
||||||
&chain_hash));
|
&chain_hash));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: use uintmap_get */
|
if (get_channel(rstate, &scid)) {
|
||||||
if (get_connection_by_scid(rstate, &scid, 0) || get_connection_by_scid(rstate, &scid, 1)) {
|
status_broken("Attempted to local_add_channel a known channel");
|
||||||
status_trace("Attempted to local_add_channel a know channel");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user