Skip to content

Commit

Permalink
Remove unused function json_dev_broadcast(...)
Browse files Browse the repository at this point in the history
  • Loading branch information
practicalswift committed Feb 22, 2018
1 parent 3dbace3 commit fdfe6e5
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 54 deletions.
43 changes: 0 additions & 43 deletions lightningd/chaintopology.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
}
Expand Down
9 changes: 0 additions & 9 deletions lightningd/chaintopology.h
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions lightningd/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -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=<subdaemon>", opt_subd_debug, NULL,
Expand Down

0 comments on commit fdfe6e5

Please sign in to comment.