Skip to content

Commit

Permalink
Minor fixups
Browse files Browse the repository at this point in the history
Signed-off-by: Saibato <saibato.naga@pm.me>
  • Loading branch information
Saibato committed Oct 13, 2019
1 parent 1e96707 commit 80c6316
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 13 deletions.
4 changes: 4 additions & 0 deletions common/base64.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
#include <sodium.h>
#include <sodium/utils.h>

/* Decode/encode from/to base64, base64 helper functions.
* We import base64 from libsodium to generate tor V3 ED25519-V3 onions from blobs
*/

char *b64_encode(const tal_t *ctx, char *data, size_t len)
{
char *str = tal_arrz(ctx, char, sodium_base64_encoded_len(len, sodium_base64_VARIANT_ORIGINAL) + 1);
Expand Down
7 changes: 3 additions & 4 deletions common/wireaddr.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,8 @@ bool fromwire_wireaddr_internal(const u8 **cursor, size_t *max,
case ADDR_INTERNAL_AUTOTOR:
return fromwire_wireaddr(cursor, max, &addr->u.torservice);
case ADDR_INTERNAL_STATICTOR:
fromwire_u8_array(cursor, max, (u8 *)addr->blob,
sizeof(addr->blob));

fromwire_u8_array(cursor, max, (u8 *)addr->blob,
sizeof(addr->blob));
return fromwire_wireaddr(cursor, max, &addr->u.torservice);
case ADDR_INTERNAL_WIREADDR:
return fromwire_wireaddr(cursor, max, &addr->u.wireaddr);
Expand Down Expand Up @@ -445,7 +444,7 @@ bool parse_wireaddr_internal(const char *arg, struct wireaddr_internal *addr,
const char **err_msg)
{
u16 splitport;
char *ip;
char *ip = NULL;
bool needed_dns = false;

/* Addresses starting with '/' are local socket paths */
Expand Down
2 changes: 1 addition & 1 deletion common/wireaddr.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ struct sockaddr_un;
#define TOR_V3_ADDRLEN 35
#define LARGEST_ADDRLEN TOR_V3_ADDRLEN
#define TOR_V3_BLOBLEN 64
#define TOR_UNIQUE_STRING "gen-default-toraddress"
#define TOR_UNIQUE_STRING "gen-default-toraddress"

enum wire_addr_type {
ADDR_TYPE_IPV4 = 1,
Expand Down
1 change: 0 additions & 1 deletion connectd/tor_autoservice.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
static void *buf_resize(struct membuf *mb, void *buf, size_t len)
{
tal_resize(&buf, len);

return buf;
}

Expand Down
1 change: 1 addition & 0 deletions lightningd/lightningd.c
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,7 @@ int main(int argc, char *argv[])
/*~ Our default color and alias are derived from our node id, so we
* can only set those now (if not set by config options). */
setup_color_and_alias(ld);

/*~ Set up connect daemon: this manages receiving and making
* TCP connections. It needs to talk to the gossip daemon
* which knows (via node_announcement messages) the public
Expand Down
2 changes: 1 addition & 1 deletion lightningd/lightningd.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ struct lightningd {
#endif /* DEVELOPER */

/* tor support */
struct wireaddr *proxyaddr;;
struct wireaddr *proxyaddr;
bool use_proxy_always;
char *tor_service_password;
bool pure_tor_setup;
Expand Down
2 changes: 0 additions & 2 deletions lightningd/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include <common/param.h>
#include <common/version.h>
#include <common/wireaddr.h>
#include <connectd/tor_autoservice.h>
#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>
Expand Down Expand Up @@ -1080,7 +1079,6 @@ static void register_opts(struct lightningd *ld)

opt_register_arg("--proxy", opt_add_proxy_addr, NULL,
ld,"Set a socks v5 proxy IP address and port");

opt_register_arg("--tor-service-password", opt_set_talstr, NULL,
&ld->tor_service_password,
"Set a Tor hidden service password");
Expand Down
4 changes: 0 additions & 4 deletions lightningd/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ void handle_opts(struct lightningd *ld, int argc, char *argv[]);
/* Derive default color and alias from the pubkey. */
void setup_color_and_alias(struct lightningd *ld);

/* generate the nodes Tor address */
void setup_default_tor(struct lightningd *ld);


/* Global to allow deprecated options. */
extern bool deprecated_apis;
#endif /* LIGHTNING_LIGHTNINGD_OPTIONS_H */

0 comments on commit 80c6316

Please sign in to comment.