mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-20 02:27:51 +01:00
gossip: extract function to derive seedname.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
0d23f4fb4a
commit
de063edb54
@ -1948,19 +1948,25 @@ static struct io_plan *conn_proxy_init(struct io_conn *conn,
|
|||||||
return io_tor_connect(conn, reach->daemon->proxyaddr, host, port, reach);
|
return io_tor_connect(conn, reach->daemon->proxyaddr, host, port, reach);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct addrhint *
|
static const char *seedname(const tal_t *ctx, const struct pubkey *id)
|
||||||
seed_resolve_addr(const tal_t *ctx, const struct pubkey *id, const u16 port)
|
|
||||||
{
|
{
|
||||||
struct addrhint *a;
|
char bech32[100];
|
||||||
char bech32[100], *addr;
|
|
||||||
u8 der[PUBKEY_DER_LEN];
|
u8 der[PUBKEY_DER_LEN];
|
||||||
u5 *data = tal_arr(ctx, u5, 0);
|
u5 *data = tal_arr(ctx, u5, 0);
|
||||||
|
|
||||||
pubkey_to_der(der, id);
|
pubkey_to_der(der, id);
|
||||||
bech32_push_bits(&data, der, PUBKEY_DER_LEN*8);
|
bech32_push_bits(&data, der, PUBKEY_DER_LEN*8);
|
||||||
bech32_encode(bech32, "ln", data, tal_count(data), sizeof(bech32));
|
bech32_encode(bech32, "ln", data, tal_count(data), sizeof(bech32));
|
||||||
addr = tal_fmt(ctx, "%s.lseed.bitcoinstats.com", bech32);
|
return tal_fmt(ctx, "%s.lseed.bitcoinstats.com", bech32);
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct addrhint *
|
||||||
|
seed_resolve_addr(const tal_t *ctx, const struct pubkey *id, const u16 port)
|
||||||
|
{
|
||||||
|
struct addrhint *a;
|
||||||
|
const char *addr;
|
||||||
|
|
||||||
|
addr = seedname(tmpctx, id);
|
||||||
status_trace("Resolving %s", addr);
|
status_trace("Resolving %s", addr);
|
||||||
|
|
||||||
a = tal(ctx, struct addrhint);
|
a = tal(ctx, struct addrhint);
|
||||||
|
Loading…
Reference in New Issue
Block a user