Browse Source

opts: Add the --rescan option

This is intended to recover from an inconsistent state, involving
`onchaind`. Should we for some reason not restore the `onchaind` process
correctly we can instruct `lightningd` to go back in time and just replay
everything.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
ppa-0.6.1
Christian Decker 7 years ago
parent
commit
0f191f5d4f
  1. 4
      lightningd/lightningd.h
  2. 10
      lightningd/options.c

4
lightningd/lightningd.h

@ -72,6 +72,10 @@ struct config {
/* Do we let the funder set any fee rate they want */ /* Do we let the funder set any fee rate they want */
bool ignore_fee_limits; bool ignore_fee_limits;
/* Number of blocks to rescan from the current head, or absolute
* blockheight if rescan >= 500'000 */
s32 rescan;
}; };
struct lightningd { struct lightningd {

10
lightningd/options.c

@ -309,6 +309,10 @@ static void config_register_opts(struct lightningd *ld)
opt_register_arg("--fee-base", opt_set_u32, opt_show_u32, opt_register_arg("--fee-base", opt_set_u32, opt_show_u32,
&ld->config.fee_base, &ld->config.fee_base,
"Millisatoshi minimum to charge for HTLC"); "Millisatoshi minimum to charge for HTLC");
opt_register_arg("--rescan", opt_set_s32, opt_show_s32,
&ld->config.rescan,
"Number of blocks to rescan from the current head, or "
"absolute blockheight if negative");
opt_register_arg("--fee-per-satoshi", opt_set_s32, opt_show_s32, opt_register_arg("--fee-per-satoshi", opt_set_s32, opt_show_s32,
&ld->config.fee_per_satoshi, &ld->config.fee_per_satoshi,
"Microsatoshi fee for every satoshi in HTLC"); "Microsatoshi fee for every satoshi in HTLC");
@ -420,6 +424,9 @@ static const struct config testnet_config = {
/* Testnet sucks */ /* Testnet sucks */
.ignore_fee_limits = true, .ignore_fee_limits = true,
/* Rescan 5 hours of blocks on testnet, it's reorg happy */
.rescan = 30,
}; };
/* aka. "Dude, where's my coins?" */ /* aka. "Dude, where's my coins?" */
@ -481,6 +488,9 @@ static const struct config mainnet_config = {
/* Mainnet should have more stable fees */ /* Mainnet should have more stable fees */
.ignore_fee_limits = false, .ignore_fee_limits = false,
/* Rescan 2.5 hours of blocks on startup, it's not so reorg happy */
.rescan = 15,
}; };
static void check_config(struct lightningd *ld) static void check_config(struct lightningd *ld)

Loading…
Cancel
Save