mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 14:42:40 +01:00
wireaddr: remove handling for addr->type == ADDR_TYPE_PADDING
We used to use this for "no known address", but we don't any more. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
171006d17c
commit
8600ba403c
5 changed files with 8 additions and 22 deletions
|
@ -55,10 +55,6 @@ bool fromwire_wireaddr(const u8 **cursor, size_t *max, struct wireaddr *addr)
|
|||
|
||||
void towire_wireaddr(u8 **pptr, const struct wireaddr *addr)
|
||||
{
|
||||
if (!addr || addr->type == ADDR_TYPE_PADDING) {
|
||||
towire_u8(pptr, ADDR_TYPE_PADDING);
|
||||
return;
|
||||
}
|
||||
towire_u8(pptr, addr->type);
|
||||
towire(pptr, addr->addr, addr->addrlen);
|
||||
towire_u16(pptr, addr->port);
|
||||
|
|
|
@ -158,7 +158,7 @@ static bool IsLocal(const struct wireaddr *addr)
|
|||
|
||||
static bool IsInternal(const struct wireaddr *addr)
|
||||
{
|
||||
return addr->type == ADDR_TYPE_PADDING;
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool IsValid(const struct wireaddr *addr)
|
||||
|
|
|
@ -408,10 +408,6 @@ json_tok_channel_id(const char *buffer, const jsmntok_t *tok,
|
|||
void json_add_address(struct json_stream *response, const char *fieldname,
|
||||
const struct wireaddr *addr)
|
||||
{
|
||||
/* No need to print padding */
|
||||
if (addr->type == ADDR_TYPE_PADDING)
|
||||
return;
|
||||
|
||||
json_object_start(response, fieldname);
|
||||
char *addrstr = tal_arr(response, char, INET6_ADDRSTRLEN);
|
||||
if (addr->type == ADDR_TYPE_IPV4) {
|
||||
|
|
|
@ -661,8 +661,6 @@ static void json_add_peer(struct lightningd *ld,
|
|||
* their features *last* time they connected. */
|
||||
if (connected) {
|
||||
json_array_start(response, "netaddr");
|
||||
if (p->addr.itype != ADDR_INTERNAL_WIREADDR
|
||||
|| p->addr.u.wireaddr.type != ADDR_TYPE_PADDING)
|
||||
json_add_string(response, NULL,
|
||||
type_to_string(response,
|
||||
struct wireaddr_internal,
|
||||
|
|
|
@ -1037,10 +1037,6 @@ void wallet_channel_insert(struct wallet *w, struct channel *chan)
|
|||
/* Need to create the peer first */
|
||||
stmt = db_prepare(w->db, "INSERT INTO peers (node_id, address) VALUES (?, ?);");
|
||||
sqlite3_bind_pubkey(stmt, 1, &chan->peer->id);
|
||||
if (chan->peer->addr.itype == ADDR_INTERNAL_WIREADDR
|
||||
&& chan->peer->addr.u.wireaddr.type == ADDR_TYPE_PADDING)
|
||||
sqlite3_bind_null(stmt, 2);
|
||||
else
|
||||
sqlite3_bind_text(stmt, 2,
|
||||
type_to_string(tmpctx, struct wireaddr_internal, &chan->peer->addr),
|
||||
-1, SQLITE_TRANSIENT);
|
||||
|
|
Loading…
Add table
Reference in a new issue