Makefile: update bolt version to include option_anchors_zero_fee_htlc_tx.

This touches a lot of text, mainly to change "if `option_anchor_outputs`"
to "if `option_anchors`"

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2021-09-08 09:38:14 +09:30
parent 1b2c6964fd
commit fb4edc2938
20 changed files with 54 additions and 39 deletions

View File

@@ -24,7 +24,7 @@ CCANDIR := ccan
# Where we keep the BOLT RFCs
BOLTDIR := ../lightning-rfc/
DEFAULT_BOLTVERSION := 07c7caed516f3a39370d2467685b1a48a12e50ad
DEFAULT_BOLTVERSION := fdc078f845e1e12069a0b881e95389b3a88c4ff7
# Can be overridden on cmdline.
BOLTVERSION := $(DEFAULT_BOLTVERSION)

View File

@@ -1173,7 +1173,7 @@ static struct bitcoin_signature *unraw_sigs(const tal_t *ctx,
/* BOLT #3:
* ## HTLC-Timeout and HTLC-Success Transactions
*...
* * if `option_anchor_outputs` applies to this commitment
* * if `option_anchors` applies to this commitment
* transaction, `SIGHASH_SINGLE|SIGHASH_ANYONECANPAY` is
* used.
*/
@@ -2489,7 +2489,8 @@ static void resend_commitment(struct peer *peer, struct changed_htlc *last)
/* BOLT #2:
*
* A receiving node:
* - if `option_static_remotekey` applies to the commitment transaction:
* - if `option_static_remotekey` or `option_anchors` applies to the
* commitment transaction:
* - if `next_revocation_number` is greater than expected above, AND
* `your_last_per_commitment_secret` is correct for that
* `next_revocation_number` minus 1:
@@ -2552,7 +2553,8 @@ static void check_future_dataloss_fields(struct peer *peer,
/* BOLT #2:
*
* A receiving node:
* - if `option_static_remotekey` applies to the commitment transaction:
* - if `option_static_remotekey` or `option_anchors` applies to the
* commitment transaction:
* ...
* - if `your_last_per_commitment_secret` does not match the expected values:
* - SHOULD fail the channel.
@@ -2764,7 +2766,7 @@ static void peer_reconnect(struct peer *peer,
* of the next `commitment_signed` it expects to receive.
* - MUST set `next_revocation_number` to the commitment number
* of the next `revoke_and_ack` message it expects to receive.
* - if `option_static_remotekey` applies to the commitment transaction:
* - if `option_static_remotekey` or `option_anchors` applies to the commitment transaction:
* - MUST set `my_current_per_commitment_point` to a valid point.
* - otherwise:
* - MUST set `my_current_per_commitment_point` to its commitment

View File

@@ -147,7 +147,7 @@ struct bitcoin_tx *commit_tx(const tal_t *ctx,
base_fee.satoshis /* Raw: spec uses raw numbers */);
/* BOLT #3:
* If `option_anchor_outputs` applies to the commitment
* If `option_anchors` applies to the commitment
* transaction, also subtract two times the fixed anchor size
* of 330 sats from the funder (either `to_local` or
* `to_remote`).
@@ -281,7 +281,7 @@ struct bitcoin_tx *commit_tx(const tal_t *ctx,
*
* #### `to_remote` Output
*
* If `option_anchor_outputs` applies to the commitment
* If `option_anchors` applies to the commitment
* transaction, the `to_remote` output is encumbered by a one
* block csv lock.
* <remote_pubkey> OP_CHECKSIGVERIFY 1 OP_CHECKSEQUENCEVERIFY
@@ -329,7 +329,7 @@ struct bitcoin_tx *commit_tx(const tal_t *ctx,
/* BOLT #3:
*
* 8. If `option_anchor_outputs` applies to the commitment transaction:
* 8. If `option_anchors` applies to the commitment transaction:
* * if `to_local` exists or there are untrimmed HTLCs, add a
* [`to_local_anchor` output]...
* * if `to_remote` exists or there are untrimmed HTLCs, add a

View File

@@ -680,7 +680,7 @@ static enum channel_add_err add_htlc(struct channel *channel,
return CHANNEL_ERR_CHANNEL_CAPACITY_EXCEEDED;
/* BOLT #3:
* If `option_anchor_outputs` applies to the commitment
* If `option_anchors` applies to the commitment
* transaction, also subtract two times the fixed anchor size
* of 330 sats from the funder (either `to_local` or
* `to_remote`).
@@ -1102,7 +1102,7 @@ u32 approx_max_feerate(const struct channel *channel)
avail = amount_msat_to_sat_round_down(channel->view[!channel->opener].owed[channel->opener]);
/* BOLT #3:
* If `option_anchor_outputs` applies to the commitment
* If `option_anchors` applies to the commitment
* transaction, also subtract two times the fixed anchor size
* of 330 sats from the funder (either `to_local` or
* `to_remote`).
@@ -1143,7 +1143,7 @@ bool can_opener_afford_feerate(const struct channel *channel, u32 feerate_per_kw
channel->option_anchor_outputs);
/* BOLT #3:
* If `option_anchor_outputs` applies to the commitment
* If `option_anchors` applies to the commitment
* transaction, also subtract two times the fixed anchor size
* of 330 sats from the funder (either `to_local` or
* `to_remote`).

View File

@@ -1067,7 +1067,7 @@ int main(int argc, const char *argv[])
option_anchor_outputs);
/* BOLT #3:
* If `option_anchor_outputs` applies to the commitment
* If `option_anchors` applies to the commitment
* transaction, also subtract two times the fixed anchor size
* of 330 sats from the funder (either `to_local` or
* `to_remote`).

View File

@@ -44,7 +44,7 @@ static struct bitcoin_tx *htlc_tx(const tal_t *ctx,
* * `txin[0]` outpoint: `txid` of the commitment transaction and
* `output_index` of the matching HTLC output for the HTLC
* transaction
* * `txin[0]` sequence: `0` (set to `1` for `option_anchor_outputs`)
* * `txin[0]` sequence: `0` (set to `1` for `option_anchors`)
*/
amount = amount_msat_to_sat_round_down(msat);
bitcoin_tx_add_input(tx, commit_txid, commit_output_number,

View File

@@ -47,7 +47,8 @@ static inline struct amount_sat htlc_timeout_fee(u32 feerate_per_kw,
/* BOLT #3:
*
* The fee for an HTLC-timeout transaction:
* - MUST BE calculated to match:
*...
* - Otherwise, MUST BE calculated to match:
* 1. Multiply `feerate_per_kw` by 663 (666 if `option_anchor_outputs`
* applies) and divide by 1000 (rounding down).
*/
@@ -65,6 +66,7 @@ static inline struct amount_sat htlc_success_fee(u32 feerate_per_kw,
/* BOLT #3:
*
* The fee for an HTLC-success transaction:
*...
* - MUST BE calculated to match:
* 1. Multiply `feerate_per_kw` by 703 (706 if `option_anchor_outputs`
* applies) and divide by 1000 (rounding down).

View File

@@ -143,7 +143,7 @@ struct bitcoin_tx *initial_commit_tx(const tal_t *ctx,
*
* 3. Subtract this base fee from the funder (either `to_local` or
* `to_remote`).
* If `option_anchor_outputs` applies to the commitment transaction,
* If `option_anchors` applies to the commitment transaction,
* also subtract two times the fixed anchor size of 330 sats from the
* funder (either `to_local` or `to_remote`).
*/
@@ -236,7 +236,7 @@ struct bitcoin_tx *initial_commit_tx(const tal_t *ctx,
if (amount_msat_greater_eq_sat(other_pay, dust_limit)) {
/* BOLT #3:
*
* If `option_anchor_outputs` applies to the commitment
* If `option_anchors` applies to the commitment
* transaction, the `to_remote` output is encumbered by a one
* block csv lock.
* <remote_pubkey> OP_CHECKSIGVERIFY 1 OP_CHECKSEQUENCEVERIFY
@@ -267,7 +267,7 @@ struct bitcoin_tx *initial_commit_tx(const tal_t *ctx,
to_remote = false;
/* BOLT #3:
* 8. If `option_anchor_outputs` applies to the commitment transaction:
* 8. If `option_anchors` applies to the commitment transaction:
* * if `to_local` exists or there are untrimmed HTLCs, add a
* [`to_local_anchor` output]...
* * if `to_remote` exists or there are untrimmed HTLCs, add a

View File

@@ -33,7 +33,7 @@ static inline size_t commit_tx_base_weight(size_t num_untrimmed_htlcs,
*
* The base fee for a commitment transaction:
* - MUST be calculated to match:
* 1. Start with `weight` = 724 (1124 if `option_anchor_outputs` applies).
* 1. Start with `weight` = 724 (1124 if `option_anchors` applies).
*/
if (option_anchor_outputs)
weight = 1124;

View File

@@ -20,7 +20,7 @@
* the `local_delayedpubkey` uses the local node's `delayed_payment_basepoint`;
* and the `remote_delayedpubkey` uses the remote node's `delayed_payment_basepoint`.
*...
* If `option_static_remotekey` or `option_anchor_outputs` is negotiated, the
* If `option_static_remotekey` or `option_anchors` is negotiated, the
* `remotepubkey` is simply the remote node's `payment_basepoint`, otherwise
* it is calculated as above using the remote node's `payment_basepoint`.
*/

View File

@@ -32,7 +32,7 @@ bool derive_keyset(const struct pubkey *per_commitment_point,
*
* ### `remotepubkey` Derivation
*
* If `option_static_remotekey` or `option_anchor_outputs` is
* If `option_static_remotekey` or `option_anchors` is
* negotiated, the `remotepubkey` is simply the remote node's
* `payment_basepoint`, otherwise it is calculated as above using the
* remote node's `payment_basepoint`.

View File

@@ -121,7 +121,7 @@ int main(int argc, char *argv[])
fee = commit_tx_base_fee(feerate_per_kw, 0,
option_anchor_outputs);
/* BOLT #3:
* If `option_anchor_outputs` applies to the commitment
* If `option_anchors` applies to the commitment
* transaction, also subtract two times the fixed anchor size
* of 330 sats from the funder (either `to_local` or
* `to_remote`).

View File

@@ -292,7 +292,7 @@ static void hsm_unilateral_close_privkey(struct privkey *dst,
/* BOLT #3:
*
* If `option_static_remotekey` or `option_anchor_outputs` is
* If `option_static_remotekey` or `option_anchors` is
* negotiated, the `remotepubkey` is simply the remote node's
* `payment_basepoint`, otherwise it is calculated as above using the
* remote node's `payment_basepoint`.
@@ -1041,7 +1041,7 @@ static u8 *handle_sign_local_htlc_tx(struct hsmd_client *c, const u8 *msg_in)
/* BOLT #3:
* ## HTLC-Timeout and HTLC-Success Transactions
*...
* * if `option_anchor_outputs` applies to this commitment transaction,
* * if `option_anchors` applies to this commitment transaction,
* `SIGHASH_SINGLE|SIGHASH_ANYONECANPAY` is used.
*/
sign_tx_input(tx, 0, NULL, wscript, &htlc_privkey, &htlc_pubkey,
@@ -1094,7 +1094,7 @@ static u8 *handle_sign_remote_htlc_tx(struct hsmd_client *c, const u8 *msg_in)
/* BOLT #3:
* ## HTLC-Timeout and HTLC-Success Transactions
*...
* * if `option_anchor_outputs` applies to this commitment transaction,
* * if `option_anchors` applies to this commitment transaction,
* `SIGHASH_SINGLE|SIGHASH_ANYONECANPAY` is used.
*/
sign_tx_input(tx, 0, NULL, wscript, &htlc_privkey, &htlc_pubkey,
@@ -1289,7 +1289,7 @@ static u8 *handle_sign_remote_htlc_to_us(struct hsmd_client *c,
/* BOLT #3:
* ## HTLC-Timeout and HTLC-Success Transactions
*...
* * if `option_anchor_outputs` applies to this commitment transaction,
* * if `option_anchors` applies to this commitment transaction,
* `SIGHASH_SINGLE|SIGHASH_ANYONECANPAY` is used.
*/
return handle_sign_to_us_tx(

View File

@@ -231,7 +231,8 @@ void peer_start_closingd(struct channel *channel,
return;
}
/* BOLT #2:
/* FIXME: This is the old BOLT 2 text, which restricted the closing
* fee to cap at the final commitment fee. We still do this for now.
*
* The sending node:
* - MUST set `fee_satoshis` less than or equal to the base

View File

@@ -147,12 +147,14 @@ wallet_commit_channel(struct lightningd *ld,
* #### Requirements
*
* Both peers:
* - if `option_static_remotekey` or `option_anchor_outputs` was negotiated:
* - `option_static_remotekey` or `option_anchor_outputs` applies to all commitment
* transactions
* - if `option_static_remotekey`, `option_anchor_outputs` or
* `option_anchors_zero_fee_htlc_tx` was negotiated:
* - `option_static_remotekey`, `option_anchor_outputs` or
* `option_anchors_zero_fee_htlc_tx` applies to all commitment transactions
* - otherwise:
* - `option_static_remotekey` or `option_anchor_outputs` does not apply to any commitment
* transactions
* - `option_static_remotekey`, `option_anchor_outputs` or
* `option_anchors_zero_fee_htlc_tx` does not apply to any commitment
* transactions
*/
/* i.e. We set it now for the channel permanently. */
if (feature_negotiated(ld->our_features,

View File

@@ -612,7 +612,7 @@ static struct amount_sat commit_txfee(const struct channel *channel,
if (channel->option_anchor_outputs) {
/* BOLT #3:
* If `option_anchor_outputs` applies to the commitment
* If `option_anchors` applies to the commitment
* transaction, also subtract two times the fixed anchor size
* of 330 sats from the funder (either `to_local` or
* `to_remote`).

View File

@@ -470,13 +470,17 @@ static bool grind_htlc_tx_fee(struct amount_sat *fee,
/* BOLT #3:
*
* The fee for an HTLC-timeout transaction:
* - MUST BE calculated to match:
* - If `option_anchors_zero_fee_htlc_tx` applies:
* 1. MUST BE 0.
* - Otherwise, MUST BE calculated to match:
* 1. Multiply `feerate_per_kw` by 663
* (666 if `option_anchor_outputs` applies)
* and divide by 1000 (rounding down).
*
* The fee for an HTLC-success transaction:
* - MUST BE calculated to match:
* - If `option_anchors_zero_fee_htlc_tx` applies:
* 1. MUST BE 0.
* - MUST BE calculated to match:
* 1. Multiply `feerate_per_kw` by 703
* (706 if `option_anchor_outputs` applies)
* and divide by 1000 (rounding down).
@@ -517,7 +521,9 @@ static bool set_htlc_timeout_fee(struct bitcoin_tx *tx,
/* BOLT #3:
*
* The fee for an HTLC-timeout transaction:
* - MUST BE calculated to match:
* - If `option_anchors_zero_fee_htlc_tx` applies:
* 1. MUST BE 0.
* - Otherwise, MUST BE calculated to match:
* 1. Multiply `feerate_per_kw` by 663 (666 if `option_anchor_outputs`
* applies) and divide by 1000 (rounding down).
*/
@@ -564,6 +570,8 @@ static void set_htlc_success_fee(struct bitcoin_tx *tx,
/* BOLT #3:
*
* The fee for an HTLC-success transaction:
* - If `option_anchors_zero_fee_htlc_tx` applies:
* 1. MUST BE 0.
* - MUST BE calculated to match:
* 1. Multiply `feerate_per_kw` by 703 (706 if `option_anchor_outputs`
* applies) and divide by 1000 (rounding down).
@@ -2566,7 +2574,7 @@ static u8 *scriptpubkey_to_remote(const tal_t *ctx,
*
* #### `to_remote` Output
*
* If `option_anchor_outputs` applies to the commitment
* If `option_anchors` applies to the commitment
* transaction, the `to_remote` output is encumbered by a one
* block csv lock.
* <remote_pubkey> OP_CHECKSIGVERIFY 1 OP_CHECKSEQUENCEVERIFY

View File

@@ -63,7 +63,7 @@ bool check_config_bounds(const tal_t *ctx,
}
/* BOLT #2:
* - if `option_anchor_outputs` applies to this commitment
* - if `option_anchors` applies to this commitment
* transaction and the sending node is the funder:
* - MUST be able to additionally pay for `to_local_anchor` and
* `to_remote_anchor` above its reserve.

View File

@@ -3417,7 +3417,7 @@ static bool dualopend_handle_custommsg(const u8 *msg)
/* BOLT #2:
*
* A receiving node:
* - if `option_static_remotekey` applies to the commitment transaction:
* - if `option_static_remotekey` or `option_anchors` applies to the commitment transaction:
* - if `next_revocation_number` is greater than expected above, AND
* `your_last_per_commitment_secret` is correct for that
* `next_revocation_number` minus 1:

View File

@@ -896,7 +896,7 @@ wallet_htlc_sigs_load(const tal_t *ctx, struct wallet *w, u64 channelid,
/* BOLT #3:
* ## HTLC-Timeout and HTLC-Success Transactions
*...
* * if `option_anchor_outputs` applies to this commitment
* * if `option_anchors` applies to this commitment
* transaction, `SIGHASH_SINGLE|SIGHASH_ANYONECANPAY` is
* used.
*/