From fdfe6e5076d8ebfd7f20926b69c3d90e076496fe Mon Sep 17 00:00:00 2001 From: practicalswift Date: Wed, 21 Feb 2018 16:16:21 +0100 Subject: [PATCH] Remove unused function json_dev_broadcast(...) --- lightningd/chaintopology.c | 43 -------------------------------------- lightningd/chaintopology.h | 9 -------- lightningd/options.c | 2 -- 3 files changed, 54 deletions(-) diff --git a/lightningd/chaintopology.c b/lightningd/chaintopology.c index 10f60428631d..562e6530a1e8 100644 --- a/lightningd/chaintopology.c +++ b/lightningd/chaintopology.c @@ -181,11 +181,6 @@ static void rebroadcast_txs(struct chain_topology *topo, struct command *cmd) struct txs_to_broadcast *txs; struct outgoing_tx *otx; -#if DEVELOPER - if (topo->dev_no_broadcast) - return; -#endif /* DEVELOPER */ - txs = tal(topo, struct txs_to_broadcast); txs->cmd = cmd; @@ -260,12 +255,6 @@ void broadcast_tx(struct chain_topology *topo, log_add(topo->log, " (tx %s)", type_to_string(ltmp, struct bitcoin_txid, &otx->txid)); -#if DEVELOPER - if (topo->dev_no_broadcast) { - broadcast_done(topo->bitcoind, 0, "dev_no_broadcast", otx); - return; - } -#endif bitcoind_sendrawtx(topo->bitcoind, otx->hextx, broadcast_done, otx); } @@ -554,35 +543,6 @@ struct txlocator *locate_tx(const void *ctx, const struct chain_topology *topo, } #if DEVELOPER -void json_dev_broadcast(struct command *cmd, - struct chain_topology *topo, - const char *buffer, const jsmntok_t *params) -{ - jsmntok_t *enabletok; - bool enable; - - if (!json_get_params(cmd, buffer, params, - "enable", &enabletok, - NULL)) { - return; - } - - if (!json_tok_bool(buffer, enabletok, &enable)) { - command_fail(cmd, "Enable must be true or false"); - return; - } - - log_debug(cmd->ld->log, "dev-broadcast: broadcast %s", - enable ? "enabled" : "disabled"); - cmd->ld->topology->dev_no_broadcast = !enable; - - /* If enabling, flush and wait. */ - if (enable) - rebroadcast_txs(cmd->ld->topology, cmd); - else - command_success(cmd, null_response(cmd)); -} - static void json_dev_blockheight(struct command *cmd, const char *buffer, const jsmntok_t *params) { @@ -706,9 +666,6 @@ struct chain_topology *new_topology(struct lightningd *ld, struct log *log) topo->default_fee_rate = 40000; topo->override_fee_rate = NULL; topo->bitcoind = new_bitcoind(topo, ld, log); -#if DEVELOPER - topo->dev_no_broadcast = false; -#endif return topo; } diff --git a/lightningd/chaintopology.h b/lightningd/chaintopology.h index b35776c8e28e..512ed50ba0fd 100644 --- a/lightningd/chaintopology.h +++ b/lightningd/chaintopology.h @@ -113,11 +113,6 @@ struct chain_topology { /* Transactions/txos we are watching. */ struct txwatch_hash txwatches; struct txowatch_hash txowatches; - -#if DEVELOPER - /* Suppress broadcast (for testing) */ - bool dev_no_broadcast; -#endif }; /* Information relevant to locating a TX in a blockchain. */ @@ -163,10 +158,6 @@ void notify_new_block(struct lightningd *ld, unsigned int height); void notify_feerate_change(struct lightningd *ld); #if DEVELOPER -void json_dev_broadcast(struct command *cmd, - struct chain_topology *topo, - const char *buffer, const jsmntok_t *params); - void chaintopology_mark_pointers_used(struct htable *memtable, const struct chain_topology *topo); #endif diff --git a/lightningd/options.c b/lightningd/options.c index 857ebb356065..8f4d4a6eef48 100644 --- a/lightningd/options.c +++ b/lightningd/options.c @@ -300,8 +300,6 @@ static void dev_register_opts(struct lightningd *ld) opt_register_noarg("--dev-no-reconnect", opt_set_bool, &ld->no_reconnect, "Disable automatic reconnect attempts"); - opt_register_noarg("--dev-no-broadcast", opt_set_bool, - &ld->topology->dev_no_broadcast, opt_hidden); opt_register_noarg("--dev-fail-on-subdaemon-fail", opt_set_bool, &ld->dev_subdaemon_fail, opt_hidden); opt_register_arg("--dev-debugger=", opt_subd_debug, NULL,