mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-17 19:03:42 +01:00
gossip: Pull up the check for new channels before checking the txout
We drop all but the first announcement, so any work that is done for a channel that we already know is wasted. Pulling this up duplicates some of the work but allows us to skip the costly txout check. Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
parent
d9d618aff9
commit
7a651c62fa
@ -545,6 +545,7 @@ const struct short_channel_id *handle_channel_announcement(
|
|||||||
const char *tag;
|
const char *tag;
|
||||||
secp256k1_ecdsa_signature node_signature_1, node_signature_2;
|
secp256k1_ecdsa_signature node_signature_1, node_signature_2;
|
||||||
secp256k1_ecdsa_signature bitcoin_signature_1, bitcoin_signature_2;
|
secp256k1_ecdsa_signature bitcoin_signature_1, bitcoin_signature_2;
|
||||||
|
struct node_connection *c0, *c1;
|
||||||
|
|
||||||
pending = tal(rstate, struct pending_cannouncement);
|
pending = tal(rstate, struct pending_cannouncement);
|
||||||
pending->updates[0] = NULL;
|
pending->updates[0] = NULL;
|
||||||
@ -619,10 +620,16 @@ const struct short_channel_id *handle_channel_announcement(
|
|||||||
|
|
||||||
/* FIXME: Handle duplicates as per BOLT #7 */
|
/* FIXME: Handle duplicates as per BOLT #7 */
|
||||||
|
|
||||||
if (find_pending_cannouncement(rstate, &pending->short_channel_id) != NULL) {
|
c0 = get_connection(rstate, &pending->node_id_2, &pending->node_id_1);
|
||||||
/* Drop it like it's hot */
|
c1 = get_connection(rstate, &pending->node_id_1, &pending->node_id_2);
|
||||||
|
|
||||||
|
/* If we know the channels, or we have already a pending check, then skip */
|
||||||
|
if ((c0 != NULL && c1 != NULL) ||
|
||||||
|
find_pending_cannouncement(rstate, &pending->short_channel_id) !=
|
||||||
|
NULL) {
|
||||||
return tal_free(pending);
|
return tal_free(pending);
|
||||||
}
|
}
|
||||||
|
|
||||||
list_add_tail(&rstate->pending_cannouncement, &pending->list);
|
list_add_tail(&rstate->pending_cannouncement, &pending->list);
|
||||||
return &pending->short_channel_id;
|
return &pending->short_channel_id;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user