Browse Source

Remove unused function json_dev_broadcast(...)

ppa-0.6.1
practicalswift 7 years ago
committed by Rusty Russell
parent
commit
f15868a94d
  1. 43
      lightningd/chaintopology.c
  2. 9
      lightningd/chaintopology.h
  3. 2
      lightningd/options.c

43
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 UNUSED, const jsmntok_t *params UNUSED)
{
@ -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;
}

9
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

2
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=<subdaemon>", opt_subd_debug, NULL,

Loading…
Cancel
Save