Browse Source

wireaddr: update bolt version, remove 'padding' from addresses.

Nobody used this, so it was removed from the spec.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
plugin-1
Rusty Russell 6 years ago
parent
commit
c236361efd
  1. 2
      Makefile
  2. 5
      common/wireaddr.c
  3. 3
      common/wireaddr.h
  4. 5
      connectd/connectd.c
  5. 1
      connectd/netaddress.c
  6. 2
      devtools/gossipwith.c
  7. 4
      gossipd/routing.c
  8. 2
      lightningd/peer_htlcs.c

2
Makefile

@ -9,7 +9,7 @@ CCANDIR := ccan
# Where we keep the BOLT RFCs
BOLTDIR := ../lightning-rfc/
BOLTVERSION := b6ae60d24138a3601561fbc1c9d82d983595ae4f
BOLTVERSION := 8516beb2c4fe6fc19bb4b1824b1635ae13805f49
-include config.vars

5
common/wireaddr.c

@ -182,7 +182,6 @@ bool wireaddr_is_wildcard(const struct wireaddr *addr)
case ADDR_TYPE_IPV6:
case ADDR_TYPE_IPV4:
return memeqzero(addr->addr, addr->addrlen);
case ADDR_TYPE_PADDING:
case ADDR_TYPE_TOR_V2:
case ADDR_TYPE_TOR_V3:
return false;
@ -229,8 +228,6 @@ char *fmt_wireaddr_without_port(const tal_t * ctx, const struct wireaddr *a)
case ADDR_TYPE_TOR_V3:
return tal_fmt(ctx, "%s.onion",
b32_encode(tmpctx, a->addr, a->addrlen));
case ADDR_TYPE_PADDING:
break;
}
hex = tal_hexstr(ctx, a->addr, a->addrlen);
@ -562,7 +559,6 @@ struct addrinfo *wireaddr_to_addrinfo(const tal_t *ctx,
return ai;
case ADDR_TYPE_TOR_V2:
case ADDR_TYPE_TOR_V3:
case ADDR_TYPE_PADDING:
break;
}
abort();
@ -587,7 +583,6 @@ bool all_tor_addresses(const struct wireaddr_internal *wireaddr)
return false;
case ADDR_TYPE_TOR_V2:
case ADDR_TYPE_TOR_V3:
case ADDR_TYPE_PADDING:
continue;
}
}

3
common/wireaddr.h

@ -27,7 +27,6 @@ struct sockaddr_un;
*
* The following `address descriptor` types are defined:
*
* * `0`: padding; data = none (length 0)
* * `1`: ipv4; data = `[4:ipv4_addr][2:port]` (length 6)
* * `2`: ipv6; data = `[16:ipv6_addr][2:port]` (length 18)
* * `3`: Tor v2 onion service; data = `[10:onion_addr][2:port]` (length 12)
@ -46,7 +45,6 @@ struct sockaddr_un;
#define LARGEST_ADDRLEN TOR_V3_ADDRLEN
enum wire_addr_type {
ADDR_TYPE_PADDING = 0,
ADDR_TYPE_IPV4 = 1,
ADDR_TYPE_IPV6 = 2,
ADDR_TYPE_TOR_V2 = 3,
@ -71,7 +69,6 @@ enum addr_listen_announce {
ADDR_LISTEN_AND_ANNOUNCE = ADDR_LISTEN|ADDR_ANNOUNCE
};
/* Inserts a single ADDR_TYPE_PADDING if addr is NULL */
void towire_wireaddr(u8 **pptr, const struct wireaddr *addr);
bool fromwire_wireaddr(const u8 **cursor, size_t *max, struct wireaddr *addr);

5
connectd/connectd.c

@ -703,8 +703,6 @@ static void try_connect_one_addr(struct connecting *connect)
case ADDR_TYPE_IPV6:
af = AF_INET6;
break;
case ADDR_TYPE_PADDING:
break;
}
}
@ -852,7 +850,6 @@ static bool handle_wireaddr_listen(struct daemon *daemon,
return true;
}
return false;
case ADDR_TYPE_PADDING:
case ADDR_TYPE_TOR_V2:
case ADDR_TYPE_TOR_V3:
break;
@ -906,8 +903,6 @@ static void finalize_announcable(struct wireaddr **announcable)
*
* The origin node:
*...
* - MUST place non-zero typed address descriptors in ascending order.
*...
* - MUST NOT include more than one `address descriptor` of the same
* type.
*/

1
connectd/netaddress.c

@ -260,7 +260,6 @@ bool guess_address(struct wireaddr *addr)
}
case ADDR_TYPE_TOR_V2:
case ADDR_TYPE_TOR_V3:
case ADDR_TYPE_PADDING:
status_broken("Cannot guess address type %u", addr->type);
break;
}

2
devtools/gossipwith.c

@ -207,8 +207,6 @@ int main(int argc, char *argv[])
case ADDR_TYPE_IPV6:
af = AF_INET6;
break;
case ADDR_TYPE_PADDING:
abort();
}
ai = wireaddr_to_addrinfo(tmpctx, &addr.u.wireaddr);
}

4
gossipd/routing.c

@ -1280,10 +1280,6 @@ static struct wireaddr *read_addresses(const tal_t *ctx, const u8 *ser)
while (cursor && len) {
struct wireaddr wireaddr;
/* Skip any padding */
while (len && cursor[0] == ADDR_TYPE_PADDING)
fromwire_u8(&cursor, &len);
/* BOLT #7:
*
* The final node:

2
lightningd/peer_htlcs.c

@ -491,7 +491,7 @@ static void forward_htlc(struct htlc_in *hin,
*
* The origin node:
* - SHOULD accept HTLCs that pay a fee equal to or greater than:
* - fee_base_msat + ( amount_msat * fee_proportional_millionths / 1000000 )
* - fee_base_msat + ( amount_to_forward * fee_proportional_millionths / 1000000 )
*/
if (mul_overflows_u64(amt_to_forward,
ld->config.fee_per_satoshi)) {

Loading…
Cancel
Save