Makefile: update to latest BOLT versions.

The main change which affects us is that 2016 blocks to forget a channel
is a fixed number in the spec; we make this clear by renaming the
(developer-only) max_funding_unconfirmed to dev_max_funding_unconfirmed
and making it compile DEVELOPER only.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2021-04-06 06:42:11 +09:30
parent c8dbcac38e
commit 3ccb6d6e7a
10 changed files with 16 additions and 15 deletions

View File

@@ -679,14 +679,13 @@ is_fundee_should_forget(struct lightningd *ld,
struct channel *channel,
u32 block_height)
{
u32 max_funding_unconfirmed = ld->max_funding_unconfirmed;
/* BOLT #2:
*
* A non-funding node (fundee):
* - SHOULD forget the channel if it does not see the
* correct funding transaction after a reasonable timeout.
* correct funding transaction after a timeout of 2016 blocks.
*/
u32 max_funding_unconfirmed = IFDEV(ld->dev_max_funding_unconfirmed, 2016);
/* Only applies if we are fundee. */
if (channel->opener == LOCAL)

View File

@@ -1229,7 +1229,7 @@ static void handle_peer_wants_to_close(struct subd *dualopend,
* 1. `OP_DUP` `OP_HASH160` `20` 20-bytes `OP_EQUALVERIFY` `OP_CHECKSIG`
* (pay to pubkey hash), OR
* 2. `OP_HASH160` `20` 20-bytes `OP_EQUAL` (pay to script hash), OR
* 3. `OP_0` `20` 20-bytes (version 0 pay to witness pubkey), OR
* 3. `OP_0` `20` 20-bytes (version 0 pay to witness pubkey hash), OR
* 4. `OP_0` `32` 32-bytes (version 0 pay to witness script hash)
*
* A receiving node:

View File

@@ -140,6 +140,7 @@ static struct lightningd *new_lightningd(const tal_t *ctx)
ld->dev_force_tmp_channel_id = NULL;
ld->dev_no_htlc_timeout = false;
ld->dev_no_version_checks = false;
ld->dev_max_funding_unconfirmed = 2016;
#endif
/*~ These are CCAN lists: an embedded double-linked list. It's not
@@ -226,7 +227,6 @@ static struct lightningd *new_lightningd(const tal_t *ctx)
ld->use_proxy_always = false;
ld->pure_tor_setup = false;
ld->tor_service_password = NULL;
ld->max_funding_unconfirmed = 2016;
/*~ This is initialized later, but the plugin loop examines this,
* so set it to NULL explicitly now. */

View File

@@ -194,10 +194,6 @@ struct lightningd {
/* PID file */
char *pidfile;
/* Number of blocks we wait for a channel to get funded
* if we are the fundee. */
u32 max_funding_unconfirmed;
/* RPC which asked us to shutdown, if non-NULL */
struct io_conn *stop_conn;
/* RPC response to send once we've shut down. */
@@ -243,6 +239,10 @@ struct lightningd {
bool dev_no_htlc_timeout;
bool dev_no_version_checks;
/* Number of blocks we wait for a channel to get funded
* if we are the fundee. */
u32 dev_max_funding_unconfirmed;
#endif /* DEVELOPER */
/* tor support */

View File

@@ -581,7 +581,7 @@ static void dev_register_opts(struct lightningd *ld)
"Force HSM to use these for all per-channel secrets");
opt_register_arg("--dev-max-funding-unconfirmed-blocks",
opt_set_u32, opt_show_u32,
&ld->max_funding_unconfirmed,
&ld->dev_max_funding_unconfirmed,
"Maximum number of blocks we wait for a channel "
"funding transaction to confirm, if we are the "
"fundee.");