diff --git a/lightningd/lightningd.c b/lightningd/lightningd.c index 2341dd283..f36f93467 100644 --- a/lightningd/lightningd.c +++ b/lightningd/lightningd.c @@ -127,6 +127,7 @@ static struct lightningd *new_lightningd(const tal_t *ctx) ld->dev_force_channel_secrets = NULL; ld->dev_force_channel_secrets_shaseed = NULL; ld->dev_force_tmp_channel_id = NULL; + ld->dev_no_htlc_timeout = false; #endif /*~ These are CCAN lists: an embedded double-linked list. It's not diff --git a/lightningd/lightningd.h b/lightningd/lightningd.h index e3902211d..3811a9806 100644 --- a/lightningd/lightningd.h +++ b/lightningd/lightningd.h @@ -225,6 +225,10 @@ struct lightningd { struct sha256 *dev_force_channel_secrets_shaseed; struct channel_id *dev_force_tmp_channel_id; + + /* For slow tests (eg protocol tests) don't die if HTLC not + * committed in 30 secs */ + bool dev_no_htlc_timeout; #endif /* DEVELOPER */ /* tor support */ diff --git a/lightningd/options.c b/lightningd/options.c index a86acf557..c3c7cfda0 100644 --- a/lightningd/options.c +++ b/lightningd/options.c @@ -548,6 +548,9 @@ static void dev_register_opts(struct lightningd *ld) "fundee."); opt_register_arg("--dev-force-tmp-channel-id", opt_force_tmp_channel_id, NULL, ld, "Force the temporary channel id, instead of random"); + opt_register_noarg("--dev-no-htlc-timeout", opt_set_bool, + &ld->dev_no_htlc_timeout, + "Don't kill channeld if HTLCs not confirmed within 30 seconds"); } #endif /* DEVELOPER */ diff --git a/lightningd/peer_htlcs.c b/lightningd/peer_htlcs.c index 20437102a..c92b4add9 100644 --- a/lightningd/peer_htlcs.c +++ b/lightningd/peer_htlcs.c @@ -463,7 +463,7 @@ enum onion_type send_htlc_out(struct channel *out, tal_add_destructor(hout, destroy_hout_subd_died); /* Give channel 30 seconds to commit (first) htlc. */ - if (!out->htlc_timeout) + if (!out->htlc_timeout && !IFDEV(out->peer->ld->dev_no_htlc_timeout, 0)) out->htlc_timeout = new_reltimer(out->peer->ld->timers, out, time_from_sec(30), htlc_offer_timeout,