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

@@ -24,7 +24,7 @@ CCANDIR := ccan
# Where we keep the BOLT RFCs
BOLTDIR := ../lightning-rfc/
BOLTVERSION := edd45ecf22095ce97c1b5e9136a7d79351bd68cb
BOLTVERSION := b201efe0546120c14bf154ce5f4e18da7243fe7a
-include config.vars

View File

@@ -513,7 +513,8 @@ int main(int argc, const char *argv[])
*
* To start, common basic parameters for each test vector are defined:
* the HTLCs are not used for the first "simple commitment tx with no
* HTLCs" test.
* HTLCs" test, and HTLCs 5 and 6 are only used in the "same amount and
* preimage" test.
*
* funding_tx_id: 8984484a580b825b9972d7adb15050b3ab624ccd731946b3eeddb92f4e7ef6be
* funding_output_index: 0

View File

@@ -392,7 +392,8 @@ int main(int argc, const char *argv[])
*
* To start, common basic parameters for each test vector are defined:
* the HTLCs are not used for the first "simple commitment tx with no
* HTLCs" test.
* HTLCs" test, and HTLCs 5 and 6 are only used in the "same amount and
* preimage" test.
*
* funding_tx_id: 8984484a580b825b9972d7adb15050b3ab624ccd731946b3eeddb92f4e7ef6be
* funding_output_index: 0

View File

@@ -594,7 +594,7 @@ struct bolt11 *bolt11_decode_nosig(const tal_t *ctx, const char *str,
*
* The human-readable part of a Lightning invoice consists of two sections:
* 1. `prefix`: `ln` + BIP-0173 currency prefix (e.g. `lnbc` for Bitcoin mainnet,
* `lntb` for Bitcoin testnet, and `lnbcrt` for Bitcoin regtest)
* `lntb` for Bitcoin testnet, `lntbs` for Bitcoin signet, and `lnbcrt` for Bitcoin regtest)
* 1. `amount`: optional number in that currency, followed by an optional
* `multiplier` letter. The unit encoded here is the 'social' convention of a payment unit -- in the case of Bitcoin the unit is 'bitcoin' NOT satoshis.
*/

View File

@@ -8,7 +8,7 @@
* 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

@@ -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.");