mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 01:43:36 +01:00
common: remove #if DEVELOPER.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
dee94f215b
commit
c5f6893e28
@ -67,7 +67,7 @@ const char *configvar_parse(struct configvar *cv,
|
||||
}
|
||||
|
||||
if ((ot->type & OPT_DEV) && !developer)
|
||||
return "requires DEVELOPER";
|
||||
return "requires --developer";
|
||||
|
||||
/* If we're early and we want late, or vv, ignore. */
|
||||
if (!!(ot->type & OPT_EARLY) != early)
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include <common/derive_basepoints.h>
|
||||
#include <common/utils.h>
|
||||
|
||||
#if DEVELOPER
|
||||
/* If they specify --dev-force-channel-secrets it ends up in here. */
|
||||
struct secrets *dev_force_channel_secrets;
|
||||
struct sha256 *dev_force_channel_secrets_shaseed;
|
||||
@ -25,18 +24,6 @@ void fromwire_secrets(const u8 **ptr, size_t *max, struct secrets *s)
|
||||
fromwire_secret(ptr, max, &s->delayed_payment_basepoint_secret);
|
||||
fromwire_secret(ptr, max, &s->htlc_basepoint_secret);
|
||||
}
|
||||
#else /* !DEVELOPER */
|
||||
/* Generate code refers to this, but should never be called! */
|
||||
void towire_secrets(u8 **pptr, const struct secrets *s)
|
||||
{
|
||||
abort();
|
||||
}
|
||||
|
||||
void fromwire_secrets(const u8 **ptr, size_t *max, struct secrets *s)
|
||||
{
|
||||
abort();
|
||||
}
|
||||
#endif
|
||||
|
||||
struct keys {
|
||||
struct privkey f, r, h, p, d;
|
||||
@ -48,7 +35,6 @@ static void derive_keys(const struct secret *seed, struct keys *keys)
|
||||
hkdf_sha256(keys, sizeof(*keys), NULL, 0, seed, sizeof(*seed),
|
||||
"c-lightning", strlen("c-lightning"));
|
||||
|
||||
#if DEVELOPER
|
||||
if (dev_force_channel_secrets) {
|
||||
keys->f = dev_force_channel_secrets->funding_privkey;
|
||||
keys->r.secret = dev_force_channel_secrets->revocation_basepoint_secret;
|
||||
@ -58,7 +44,6 @@ static void derive_keys(const struct secret *seed, struct keys *keys)
|
||||
}
|
||||
if (dev_force_channel_secrets_shaseed)
|
||||
keys->shaseed = *dev_force_channel_secrets_shaseed;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool derive_basepoints(const struct secret *seed,
|
||||
|
@ -155,12 +155,9 @@ void fromwire_basepoints(const u8 **ptr, size_t *max,
|
||||
struct basepoints *b);
|
||||
|
||||
/* For --dev-force-channel-secrets. */
|
||||
#if DEVELOPER
|
||||
extern struct secrets *dev_force_channel_secrets;
|
||||
extern struct sha256 *dev_force_channel_secrets_shaseed;
|
||||
#endif
|
||||
|
||||
/* Note: these abort if !DEVELOPER */
|
||||
void towire_secrets(u8 **pptr, const struct secrets *s);
|
||||
void fromwire_secrets(const u8 **ptr, size_t *max, struct secrets *s);
|
||||
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include <unistd.h>
|
||||
#include <wire/peer_wire.h>
|
||||
|
||||
#if DEVELOPER
|
||||
/* We move the fd if and only if we do a disconnect. */
|
||||
static int dev_disconnect_fd = -1;
|
||||
static char dev_disconnect_line[200];
|
||||
@ -105,4 +104,3 @@ void dev_sabotage_fd(int fd, bool close_fd)
|
||||
dup2(fds[1], fd);
|
||||
close(fds[1]);
|
||||
}
|
||||
#endif
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include "config.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
#if DEVELOPER
|
||||
struct node_id;
|
||||
|
||||
enum dev_disconnect {
|
||||
@ -28,6 +27,4 @@ void dev_sabotage_fd(int fd, bool close_fd);
|
||||
/* For debug code to set in daemon. */
|
||||
void dev_disconnect_init(int fd);
|
||||
|
||||
#endif /* DEVELOPER */
|
||||
|
||||
#endif /* LIGHTNING_COMMON_DEV_DISCONNECT_H */
|
||||
|
@ -20,6 +20,11 @@
|
||||
#define paramcheck_assert assert
|
||||
#endif
|
||||
|
||||
/* Overridden by run-param.c */
|
||||
#ifndef paramcheck_assert
|
||||
#define paramcheck_assert assert
|
||||
#endif
|
||||
|
||||
struct param {
|
||||
const char *name;
|
||||
bool is_set;
|
||||
|
@ -31,10 +31,6 @@ bool check_ping_make_pong(const tal_t *ctx, const u8 *ping, u8 **pong)
|
||||
* or portions of initialized memory.
|
||||
*/
|
||||
ignored = tal_arrz(ctx, u8, num_pong_bytes);
|
||||
#if DEVELOPER
|
||||
/* Embed version */
|
||||
strncpy((char *)ignored, version(), num_pong_bytes);
|
||||
#endif
|
||||
*pong = towire_pong(ctx, ignored);
|
||||
tal_free(ignored);
|
||||
} else
|
||||
|
@ -588,9 +588,7 @@ struct onionpacket *create_onionpacket(
|
||||
return packet;
|
||||
}
|
||||
|
||||
#if DEVELOPER
|
||||
bool dev_fail_process_onionpacket;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Given an onionpacket msg extract the information for the current
|
||||
@ -621,8 +619,7 @@ struct route_step *process_onionpacket(
|
||||
|
||||
compute_packet_hmac(msg, assocdata, assocdatalen, &keys.mu, &hmac);
|
||||
|
||||
if (!hmac_eq(&msg->hmac, &hmac)
|
||||
|| IFDEV(dev_fail_process_onionpacket, false)) {
|
||||
if (!hmac_eq(&msg->hmac, &hmac) || dev_fail_process_onionpacket) {
|
||||
/* Computed MAC does not match expected MAC, the message was modified. */
|
||||
return tal_free(step);
|
||||
}
|
||||
@ -676,9 +673,7 @@ struct route_step *process_onionpacket(
|
||||
return step;
|
||||
}
|
||||
|
||||
#if DEVELOPER
|
||||
unsigned dev_onion_reply_length = 256;
|
||||
#endif
|
||||
|
||||
struct onionreply *create_onionreply(const tal_t *ctx,
|
||||
const struct secret *shared_secret,
|
||||
@ -699,7 +694,7 @@ struct onionreply *create_onionreply(const tal_t *ctx,
|
||||
* to 256. Deviating from this may cause older nodes to be unable to parse
|
||||
* the return message.
|
||||
*/
|
||||
const u16 onion_reply_size = IFDEV(dev_onion_reply_length, 256);
|
||||
const u16 onion_reply_size = dev_onion_reply_length;
|
||||
|
||||
/* We never do this currently, but could in future! */
|
||||
if (msglen > onion_reply_size)
|
||||
|
@ -264,12 +264,10 @@ u8 *sphinx_compressed_onion_serialize(
|
||||
struct sphinx_compressed_onion *
|
||||
sphinx_compressed_onion_deserialize(const tal_t *ctx, const u8 *src);
|
||||
|
||||
#if DEVELOPER
|
||||
/* Override to force us to reject valid onion packets */
|
||||
extern bool dev_fail_process_onionpacket;
|
||||
|
||||
/* Override to set custom onion error lengths. */
|
||||
extern unsigned dev_onion_reply_length;
|
||||
#endif
|
||||
|
||||
#endif /* LIGHTNING_COMMON_SPHINX_H */
|
||||
|
@ -33,11 +33,9 @@ const char *type_to_string_(const tal_t *ctx, const char *typename,
|
||||
break;
|
||||
}
|
||||
}
|
||||
#if DEVELOPER
|
||||
assert(s);
|
||||
#endif
|
||||
/* **BROKEN** makes CI upset, which is what we want! */
|
||||
if (!s)
|
||||
s = tal_fmt(ctx, "UNKNOWN TYPE %s", typename);
|
||||
s = tal_fmt(ctx, "**BROKEN** UNKNOWN TYPE %s", typename);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
@ -37,13 +37,11 @@ void tal_wally_end(const tal_t *parent)
|
||||
while ((p = tal_first(wally_tal_ctx)) != NULL) {
|
||||
/* Refuse to make a loop! */
|
||||
assert(p != parent);
|
||||
#if DEVELOPER
|
||||
/* Don't steal backtrace from wally_tal_ctx! */
|
||||
if (tal_name(p) && streq(tal_name(p), "backtrace")) {
|
||||
tal_free(p);
|
||||
continue;
|
||||
}
|
||||
#endif /* DEVELOPER */
|
||||
tal_steal(parent, p);
|
||||
}
|
||||
wally_tal_ctx = tal_free(wally_tal_ctx);
|
||||
|
@ -256,9 +256,6 @@ def test_ping(node_factory):
|
||||
|
||||
# channeld pinging
|
||||
ping_tests(l1, l2)
|
||||
if DEVELOPER:
|
||||
l1.daemon.wait_for_log(r'Got pong 1000 bytes \({}\.\.\.\)'
|
||||
.format(l2.info['version']))
|
||||
|
||||
|
||||
@pytest.mark.developer("needs --dev-disconnect")
|
||||
|
Loading…
Reference in New Issue
Block a user