From c94f77fd1474a7c46ef9cfdd5e195f1f5b45b713 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 4 May 2016 16:12:50 +0930 Subject: [PATCH] forever-confirms: warn if less than 100. BOLT #onchain considers 100 the minimum depth to be "irrevocable". Signed-off-by: Rusty Russell --- daemon/lightningd.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/daemon/lightningd.c b/daemon/lightningd.c index 77828b263..6cf0f7d38 100644 --- a/daemon/lightningd.c +++ b/daemon/lightningd.c @@ -125,6 +125,14 @@ static void default_config(struct config *config) config->anchor_confirms_max = 10; /* At some point, you've got to let it go... */ + /* BOLT #onchain: + * + * Outputs... are considered *irrevocably resolved* once they + * are included in a block at least 100 deep on the most-work + * blockchain. 100 blocks is far greater than the longest + * known bitcoin fork, and the same value used to wait for + * confirmations of miner's rewards[1]. + */ config->forever_confirms = 100; /* FIXME: These should float with bitcoind's recommendations! */ @@ -166,6 +174,11 @@ static void check_config(struct lightningd_state *dstate) " can't exceed commitment fee rate %"PRIu64, dstate->config.commitment_fee_rate_min, dstate->config.commitment_fee_rate); + + if (dstate->config.forever_confirms < 100) + log_unusual(dstate->base_log, + "Warning: forever-confirms of %u is less than 100!", + dstate->config.forever_confirms); } static struct lightningd_state *lightningd_state(void)