Skip to content

Commit 9fa93df

Browse files
committed
connectd: check all chain hashs of the array
This also cleans a redundant check.
1 parent 051b5bd commit 9fa93df

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

connectd/peer_exchange_initmsg.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ struct peer {
3030
static bool contains_common_chain(struct bitcoin_blkid *chains)
3131
{
3232
for (size_t i = 0; i < tal_count(chains); i++) {
33-
if (bitcoin_blkid_eq(&chains[0], &chainparams->genesis_blockhash))
33+
if (bitcoin_blkid_eq(&chains[i], &chainparams->genesis_blockhash))
3434
return true;
3535
}
3636
return false;
@@ -75,12 +75,6 @@ static struct io_plan *peer_init_received(struct io_conn *conn,
7575
* - MAY fail the connection.
7676
*/
7777
if (tlvs->networks) {
78-
if (!tlvs->networks->chains) {
79-
status_peer_debug(&peer->id,
80-
"bad networks TLV in init '%s', closing",
81-
tal_hex(tmpctx, msg));
82-
return io_close(conn);
83-
}
8478
if (!contains_common_chain(tlvs->networks->chains)) {
8579
status_peer_debug(&peer->id,
8680
"No common chain with this peer '%s', closing",

0 commit comments

Comments
 (0)