mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-17 19:03:42 +01:00
Avoid static analyzer warnings about potentially uninitialized values
This commit is contained in:
parent
f083a699e2
commit
5db73c6e27
@ -1518,7 +1518,7 @@ static void gossip_refresh_network(struct daemon *daemon)
|
||||
static struct io_plan *connection_in(struct io_conn *conn, struct daemon *daemon)
|
||||
{
|
||||
struct wireaddr addr;
|
||||
struct sockaddr_storage s;
|
||||
struct sockaddr_storage s = {};
|
||||
socklen_t len = sizeof(s);
|
||||
|
||||
if (getpeername(io_conn_fd(conn), (struct sockaddr *)&s, &len) != 0) {
|
||||
@ -1577,7 +1577,7 @@ static void setup_listeners(struct daemon *daemon, u16 portnum)
|
||||
/* IPv6, since on Linux that (usually) binds to IPv4 too. */
|
||||
fd1 = make_listen_fd(AF_INET6, &addr6, sizeof(addr6), true);
|
||||
if (fd1 >= 0) {
|
||||
struct sockaddr_in6 in6;
|
||||
struct sockaddr_in6 in6 = {};
|
||||
|
||||
len = sizeof(in6);
|
||||
if (getsockname(fd1, (void *)&in6, &len) != 0) {
|
||||
|
@ -200,6 +200,7 @@ int main(void)
|
||||
add_connection(rstate, &a, &b, 1, 1, 1);
|
||||
|
||||
route = find_route(tmpctx, rstate, &a, &b, 1000, riskfactor, 0.0, NULL, &fee);
|
||||
assert(route);
|
||||
assert(tal_count(route) == 1);
|
||||
assert(fee == 0);
|
||||
|
||||
@ -214,6 +215,7 @@ int main(void)
|
||||
add_connection(rstate, &b, &c, 1, 1, 1);
|
||||
|
||||
route = find_route(tmpctx, rstate, &a, &c, 1000, riskfactor, 0.0, NULL, &fee);
|
||||
assert(route);
|
||||
assert(tal_count(route) == 2);
|
||||
assert(fee == 1);
|
||||
|
||||
@ -228,6 +230,7 @@ int main(void)
|
||||
|
||||
/* Will go via D for small amounts. */
|
||||
route = find_route(tmpctx, rstate, &a, &c, 1000, riskfactor, 0.0, NULL, &fee);
|
||||
assert(route);
|
||||
assert(tal_count(route) == 2);
|
||||
assert(channel_is_between(route[0], &a, &d));
|
||||
assert(channel_is_between(route[1], &d, &c));
|
||||
@ -235,6 +238,7 @@ int main(void)
|
||||
|
||||
/* Will go via B for large amounts. */
|
||||
route = find_route(tmpctx, rstate, &a, &c, 3000000, riskfactor, 0.0, NULL, &fee);
|
||||
assert(route);
|
||||
assert(tal_count(route) == 2);
|
||||
assert(channel_is_between(route[0], &a, &b));
|
||||
assert(channel_is_between(route[1], &b, &c));
|
||||
@ -243,6 +247,7 @@ int main(void)
|
||||
/* Make B->C inactive, force it back via D */
|
||||
get_connection(rstate, &b, &c)->active = false;
|
||||
route = find_route(tmpctx, rstate, &a, &c, 3000000, riskfactor, 0.0, NULL, &fee);
|
||||
assert(route);
|
||||
assert(tal_count(route) == 2);
|
||||
assert(channel_is_between(route[0], &a, &d));
|
||||
assert(channel_is_between(route[1], &d, &c));
|
||||
|
Loading…
Reference in New Issue
Block a user