mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-26 20:30:59 +01:00
global: remove tags from BOLT quotes now dual-funding is in master
A few of them had minor wording changes, too. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
68da238b31
commit
5d061c4cf4
10 changed files with 127 additions and 140 deletions
|
@ -2586,7 +2586,7 @@ static void handle_unexpected_reestablish(struct peer *peer, const u8 *msg)
|
|||
|
||||
static bool is_initiators_serial(const struct wally_map *unknowns)
|
||||
{
|
||||
/* BOLT-f15b6b0feeffc2acd1a8466537810bbb3f824f9f #2:
|
||||
/* BOLT #2:
|
||||
* The sending node: ...
|
||||
* - if is the *initiator*:
|
||||
* - MUST send even `serial_id`s
|
||||
|
@ -2824,18 +2824,24 @@ static size_t calc_weight(enum tx_role role, const struct wally_psbt *psbt)
|
|||
{
|
||||
size_t weight = 0;
|
||||
|
||||
/* BOLT-0d8b701614b09c6ee4172b04da2203e73deec7e2 #2:
|
||||
* The initiator:
|
||||
* ...
|
||||
* - MUST pay for the common fields.
|
||||
/* BOLT #2:
|
||||
* The *initiator* is responsible for paying the fees for the following fields,
|
||||
* to be referred to as the `common fields`.
|
||||
*
|
||||
* - version
|
||||
* - segwit marker + flag
|
||||
* - input count
|
||||
* - output count
|
||||
* - locktime
|
||||
*/
|
||||
if (role == TX_INITIATOR)
|
||||
weight += bitcoin_tx_core_weight(psbt->num_inputs,
|
||||
psbt->num_outputs);
|
||||
|
||||
/* BOLT-0d8b701614b09c6ee4172b04da2203e73deec7e2 #2:
|
||||
* Each node:
|
||||
* - MUST pay for their own added inputs and outputs.
|
||||
/* BOLT #2:
|
||||
* The rest of the transaction bytes' fees are the responsibility of
|
||||
* the peer who contributed that input or output via `tx_add_input` or
|
||||
* `tx_add_output`, at the agreed upon `feerate`.
|
||||
*/
|
||||
for (size_t i = 0; i < psbt->num_inputs; i++)
|
||||
if (is_initiators_serial(&psbt->inputs[i].unknowns)) {
|
||||
|
|
|
@ -19,15 +19,14 @@ void derive_channel_id_v2(struct channel_id *channel_id,
|
|||
const struct pubkey *basepoint_1,
|
||||
const struct pubkey *basepoint_2)
|
||||
{
|
||||
/* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
/* BOLT #2:
|
||||
* `channel_id`, v2
|
||||
* For channels established using the v2 protocol, the
|
||||
* `channel_id` is the
|
||||
* SHA256(lesser-revocation-basepoint ||
|
||||
* greater-revocation-basepoint),
|
||||
* `SHA256(lesser-revocation-basepoint ||
|
||||
* greater-revocation-basepoint)`,
|
||||
* where the lesser and greater is based off the order of
|
||||
* the basepoint. The basepoints are compact
|
||||
* DER-encoded public keys.
|
||||
* the basepoint.
|
||||
*/
|
||||
u8 der_keys[PUBKEY_CMPR_LEN * 2];
|
||||
struct sha256 sha;
|
||||
|
@ -53,10 +52,10 @@ void derive_tmp_channel_id(struct channel_id *channel_id,
|
|||
{
|
||||
struct sha256 sha;
|
||||
|
||||
/* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
* If the peer's revocation basepoint is unknown
|
||||
* (e.g. `open_channel2`), a temporary `channel_id` should be
|
||||
* found by using a zeroed out basepoint for the unknown peer.
|
||||
/* BOLT #2:
|
||||
* When sending `open_channel2`, the peer's revocation basepoint is unknown.
|
||||
* A `temporary_channel_id` must be computed by using a zeroed out basepoint
|
||||
* for the non-initiator.
|
||||
*/
|
||||
u8 der_keys[PUBKEY_CMPR_LEN * 2];
|
||||
memset(der_keys, 0, PUBKEY_CMPR_LEN);
|
||||
|
|
|
@ -99,7 +99,7 @@ struct feature_set *feature_set_dup(const tal_t *ctx,
|
|||
#define COMPULSORY_FEATURE(x) ((x) & 0xFFFFFFFE)
|
||||
#define OPTIONAL_FEATURE(x) ((x) | 1)
|
||||
|
||||
/* BOLT-a526652801a541ed33b34d000a3b686a857c811f #9:
|
||||
/* BOLT #9:
|
||||
*
|
||||
* | Bits | Name |...
|
||||
* | 0/1 | `option_data_loss_protect` |... IN ...
|
||||
|
@ -116,9 +116,12 @@ struct feature_set *feature_set_dup(const tal_t *ctx,
|
|||
* | 22/23 | `option_anchors_zero_fee_htlc_tx` |... IN ...
|
||||
* | 24/25 | `option_route_blinding` |...IN9 ...
|
||||
* | 26/27 | `option_shutdown_anysegwit` |... IN ...
|
||||
* | 28/29 | `option_dual_fund` |... IN ...
|
||||
* | 38/39 | `option_onion_messages` |... IN ...
|
||||
* | 44/45 | `option_channel_type` |... IN ...
|
||||
* | 46/47 | `option_scid_alias` | ... IN ...
|
||||
* | 48/49 | `option_payment_metadata` |... 9 ...
|
||||
* | 62/63 | `option_splice` |... IN ...
|
||||
* | 50/51 | `option_zeroconf` | ... IN ...
|
||||
*/
|
||||
#define OPT_DATA_LOSS_PROTECT 0
|
||||
#define OPT_INITIAL_ROUTING_SYNC 2
|
||||
|
@ -134,8 +137,12 @@ struct feature_set *feature_set_dup(const tal_t *ctx,
|
|||
#define OPT_ANCHORS_ZERO_FEE_HTLC_TX 22
|
||||
#define OPT_ROUTE_BLINDING 24
|
||||
#define OPT_SHUTDOWN_ANYSEGWIT 26
|
||||
#define OPT_DUAL_FUND 28
|
||||
#define OPT_ONION_MESSAGES 38
|
||||
#define OPT_CHANNEL_TYPE 44
|
||||
#define OPT_SCID_ALIAS 46
|
||||
#define OPT_PAYMENT_METADATA 48
|
||||
#define OPT_ZEROCONF 50
|
||||
|
||||
/* BOLT-splice #9:
|
||||
* | 62/63 | `option_splice` | ... IN ...
|
||||
|
@ -143,29 +150,11 @@ struct feature_set *feature_set_dup(const tal_t *ctx,
|
|||
#define OPT_SPLICE 62
|
||||
#define OPT_EXPERIMENTAL_SPLICE 162
|
||||
|
||||
/* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #9:
|
||||
* | 28/29 | `option_dual_fund` | ... IN9 ...
|
||||
*/
|
||||
#define OPT_DUAL_FUND 28
|
||||
|
||||
/* BOLT-519be05f61e2c35ddf95b731203f89b4ee0946c3 #9:
|
||||
* | 46/47 | `option_scid_alias` | ... IN ...
|
||||
* | 50/51 | `option_eroconf` | ... IN ...
|
||||
*/
|
||||
#define OPT_SCID_ALIAS 46
|
||||
#define OPT_ZEROCONF 50
|
||||
|
||||
/* BOLT-quiescent #9:
|
||||
* | 34/35 | `option_quiesce` | ... IN ...
|
||||
*/
|
||||
#define OPT_QUIESCE 34
|
||||
|
||||
/* BOLT-offers #9:
|
||||
*
|
||||
* | 38/39 | `option_onion_messages` |... IN ...
|
||||
*/
|
||||
#define OPT_ONION_MESSAGES 38
|
||||
|
||||
#define OPT_SHUTDOWN_WRONG_FUNDING 104
|
||||
|
||||
/* BOLT-peer-storage #9:
|
||||
|
|
|
@ -24,14 +24,14 @@
|
|||
#include <common/wire_error.h>
|
||||
|
||||
/*
|
||||
* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
* BOLT #2:
|
||||
* The receiving node: ...
|
||||
* - MUST fail the negotiation if: ...
|
||||
* - if has received 4096 `tx_add_input` messages during this negotiation
|
||||
*/
|
||||
#define MAX_TX_ADD_INPUT_MSG_RCVD 4096
|
||||
/*
|
||||
* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
* BOLT #2:
|
||||
* The receiving node: ...
|
||||
* - MUST fail the negotiation if: ...
|
||||
* - it has received 4096 `tx_add_output` messages during this negotiation
|
||||
|
@ -39,7 +39,7 @@
|
|||
#define MAX_TX_ADD_OUTPUT_MSG_RCVD 4096
|
||||
|
||||
/*
|
||||
* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
* BOLT #2:
|
||||
* The receiving node: ...
|
||||
* - MUST fail the negotiation if: ...
|
||||
* - there are more than 252 inputs
|
||||
|
@ -428,7 +428,7 @@ char *process_interactivetx_updates(const tal_t *ctx,
|
|||
tal_hex(ctx, msg));
|
||||
|
||||
/*
|
||||
* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
* BOLT #2:
|
||||
* The receiving node: ...
|
||||
* - MUST fail the negotiation if: ...
|
||||
* - if has received 4096 `tx_add_input`
|
||||
|
@ -439,7 +439,7 @@ char *process_interactivetx_updates(const tal_t *ctx,
|
|||
" received %d",
|
||||
MAX_TX_ADD_INPUT_MSG_RCVD);
|
||||
/*
|
||||
* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
* BOLT #2:
|
||||
* The receiving node: ...
|
||||
* - MUST fail the negotiation if: ...
|
||||
* - the `serial_id` has the wrong parity
|
||||
|
@ -449,7 +449,7 @@ char *process_interactivetx_updates(const tal_t *ctx,
|
|||
"Invalid serial_id rcvd. %"PRIu64,
|
||||
serial_id);
|
||||
/*
|
||||
* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
* BOLT #2:
|
||||
* The receiving node: ...
|
||||
* - MUST fail the negotiation if: ...
|
||||
* - the `serial_id` is already included in
|
||||
|
@ -486,9 +486,9 @@ char *process_interactivetx_updates(const tal_t *ctx,
|
|||
fmt_bitcoin_tx(ctx, tx));
|
||||
|
||||
/*
|
||||
* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
* BOLT #2:
|
||||
* The receiving node: ...
|
||||
* - MUST fail the negotiation if:
|
||||
* - MUST fail the negotiation if:...
|
||||
* - the `prevtx` and `prevtx_vout` are
|
||||
* identical to a previously added (and not
|
||||
* removed) input's
|
||||
|
@ -501,7 +501,7 @@ char *process_interactivetx_updates(const tal_t *ctx,
|
|||
fmt_bitcoin_outpoint(ctx, &outpoint));
|
||||
|
||||
/*
|
||||
* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
* BOLT #2:
|
||||
* The receiving node: ...
|
||||
* - MUST fail the negotiation if: ...
|
||||
* - there are more than 252 inputs
|
||||
|
@ -513,7 +513,7 @@ char *process_interactivetx_updates(const tal_t *ctx,
|
|||
MAX_FUNDING_INPUTS);
|
||||
|
||||
/*
|
||||
* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
* BOLT #2:
|
||||
* The receiving node:
|
||||
* - MUST add all received inputs to the transaction
|
||||
*/
|
||||
|
@ -542,7 +542,7 @@ char *process_interactivetx_updates(const tal_t *ctx,
|
|||
"Parsing tx_remove_input %s",
|
||||
tal_hex(ctx, msg));
|
||||
|
||||
/* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
/* BOLT #2:
|
||||
* The receiving node: ...
|
||||
* - MUST fail the negotiation if: ...
|
||||
* - the input or output identified by the
|
||||
|
@ -555,7 +555,7 @@ char *process_interactivetx_updates(const tal_t *ctx,
|
|||
"serial_id: %"PRIu64,
|
||||
serial_id);
|
||||
|
||||
/* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
/* BOLT #2:
|
||||
* The receiving node: ...
|
||||
* - MUST fail the negotiation if: ...
|
||||
* - the `serial_id` does not correspond
|
||||
|
@ -585,7 +585,7 @@ char *process_interactivetx_updates(const tal_t *ctx,
|
|||
tal_hex(ctx, msg));
|
||||
|
||||
/*
|
||||
* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
* BOLT #2:
|
||||
* The receiving node: ...
|
||||
* - MUST fail the negotiation if: ...
|
||||
* - it has received 4096 `tx_add_output`
|
||||
|
@ -597,7 +597,7 @@ char *process_interactivetx_updates(const tal_t *ctx,
|
|||
" received (%d)",
|
||||
MAX_TX_ADD_OUTPUT_MSG_RCVD);
|
||||
|
||||
/* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
/* BOLT #2:
|
||||
* The receiving node: ...
|
||||
* - MUST fail the negotiation if: ...
|
||||
* - the `serial_id` has the wrong parity
|
||||
|
@ -607,7 +607,7 @@ char *process_interactivetx_updates(const tal_t *ctx,
|
|||
"Invalid serial_id rcvd. %"PRIu64,
|
||||
serial_id);
|
||||
|
||||
/* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
/* BOLT #2:
|
||||
* The receiving node: ...
|
||||
* - MUST fail the negotiation if: ...
|
||||
* - the `serial_id` is already included
|
||||
|
@ -618,7 +618,7 @@ char *process_interactivetx_updates(const tal_t *ctx,
|
|||
" %"PRIu64, serial_id);
|
||||
amt = amount_sat(value);
|
||||
|
||||
/* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
/* BOLT #2:
|
||||
* The receiving node: ...
|
||||
* - MAY fail the negotiation if `script`
|
||||
* is non-standard */
|
||||
|
@ -626,7 +626,7 @@ char *process_interactivetx_updates(const tal_t *ctx,
|
|||
return tal_fmt(ctx, "Script is not standard");
|
||||
|
||||
/*
|
||||
* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
* BOLT #2:
|
||||
* The receiving node: ...
|
||||
* - MUST fail the negotiation if: ...
|
||||
* - there are more than 252 outputs
|
||||
|
@ -654,7 +654,7 @@ char *process_interactivetx_updates(const tal_t *ctx,
|
|||
"Parsing tx_remove_output %s",
|
||||
tal_hex(ctx, msg));
|
||||
|
||||
/* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
/* BOLT #2:
|
||||
* The receiving node: ...
|
||||
* - MUST fail the negotiation if: ...
|
||||
* - the input or output identified by the
|
||||
|
@ -667,7 +667,7 @@ char *process_interactivetx_updates(const tal_t *ctx,
|
|||
"serial_id: %"PRIu64,
|
||||
serial_id);
|
||||
|
||||
/* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
/* BOLT #2:
|
||||
* The receiving node: ...
|
||||
* - MUST fail the negotiation if: ...
|
||||
* - the `serial_id` does not correspond to a
|
||||
|
|
|
@ -134,20 +134,18 @@ psbt_to_witnesses(const tal_t *ctx,
|
|||
if (input_index_to_ignore == i)
|
||||
continue;
|
||||
|
||||
/* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
/* BOLT #2:
|
||||
* - if is the *initiator*:
|
||||
* - MUST send even `serial_id`s
|
||||
*/
|
||||
if (wtx_s && serial_id % 2 == side_to_stack) {
|
||||
|
||||
/* BOLT-e299850cb5ebd8bd9c55763bbc498fcdf94a9567 #2:
|
||||
/* BOLT #2:
|
||||
*
|
||||
* The `witness_data` is encoded as per bitcoin's
|
||||
* wire protocol (a CompactSize number of elements,
|
||||
* with each element a CompactSize length and that
|
||||
* many bytes following. Each `witness_data` field
|
||||
* contains all of the witness elements for a single input,
|
||||
* including the leading counter of elements.
|
||||
* many bytes following).
|
||||
*/
|
||||
struct witness *wit = tal(witnesses, struct witness);
|
||||
wit->witness_data = tal_arr(wit, u8, 0);
|
||||
|
|
|
@ -805,11 +805,11 @@ static struct pubkey *extract_revocation_basepoint(const tal_t *ctx,
|
|||
|
||||
switch (t) {
|
||||
case WIRE_OPEN_CHANNEL2:
|
||||
/* BOLT-dualfund #2:
|
||||
/* BOLT #2:
|
||||
* 1. type: 64 (`open_channel2`)
|
||||
* 2. data:
|
||||
* * [`chain_hash`:`chain_hash`]
|
||||
* * [`channel_id`:`zerod_channel_id`]
|
||||
* * [`channel_id`:`temporary_channel_id`]
|
||||
* * [`u32`:`funding_feerate_perkw`]
|
||||
* * [`u32`:`commitment_feerate_perkw`]
|
||||
* * [`u64`:`funding_satoshis`]
|
||||
|
@ -837,10 +837,10 @@ static struct pubkey *extract_revocation_basepoint(const tal_t *ctx,
|
|||
+ PUBKEY_CMPR_LEN);
|
||||
break;
|
||||
case WIRE_ACCEPT_CHANNEL2:
|
||||
/* BOLT-dualfund #2:
|
||||
/* BOLT #2:
|
||||
* 1. type: 65 (`accept_channel2`)
|
||||
* 2. data:
|
||||
* * [`channel_id`:`zerod_channel_id`]
|
||||
* * [`channel_id`:`temporary_channel_id`]
|
||||
* * [`u64`:`funding_satoshis`]
|
||||
* * [`u64`:`dust_limit_satoshis`]
|
||||
* * [`u64`:`max_htlc_value_in_flight_msat`]
|
||||
|
|
|
@ -301,10 +301,6 @@ struct channel *new_unsaved_channel(struct peer *peer,
|
|||
ld->our_features,
|
||||
peer->their_features);
|
||||
|
||||
/* BOLT-7b04b1461739c5036add61782d58ac490842d98b #9
|
||||
* | 222/223 | `option_dual_fund`
|
||||
* | Use v2 of channel open, enables dual funding
|
||||
* | IN9 */
|
||||
channel->static_remotekey_start[LOCAL]
|
||||
= channel->static_remotekey_start[REMOTE] = 0;
|
||||
|
||||
|
|
|
@ -1180,7 +1180,7 @@ static struct amount_sat calculate_reserve(struct channel_config *their_config,
|
|||
{
|
||||
struct amount_sat reserve, dust_limit;
|
||||
|
||||
/* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2
|
||||
/* BOLT #2
|
||||
*
|
||||
* The channel reserve is fixed at 1% of the total channel balance
|
||||
* rounded down (sum of `funding_satoshis` from `open_channel2`
|
||||
|
@ -1833,7 +1833,7 @@ static void handle_peer_tx_sigs_sent(struct subd *dualopend,
|
|||
&channel->funding.txid,
|
||||
channel->remote_channel_ready);
|
||||
|
||||
/* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2
|
||||
/* BOLT #2
|
||||
* The receiving node: ...
|
||||
* - MUST fail the channel if:
|
||||
* - the `witness_stack` weight lowers the
|
||||
|
@ -2175,7 +2175,7 @@ static void handle_peer_tx_sigs_msg(struct subd *dualopend,
|
|||
&channel->funding.txid,
|
||||
channel->remote_channel_ready);
|
||||
|
||||
/* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2
|
||||
/* BOLT #2
|
||||
* The receiving node: ...
|
||||
* - MUST fail the channel if:
|
||||
* - the `witness_stack` weight lowers the
|
||||
|
@ -2290,11 +2290,11 @@ static void handle_validate_rbf(struct subd *dualopend,
|
|||
inputs_present = tal_arr(tmpctx, bool, candidate_psbt->num_inputs);
|
||||
memset(inputs_present, true, tal_bytelen(inputs_present));
|
||||
|
||||
/* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
/* BOLT #2:
|
||||
* The receiving node: ...
|
||||
* - MUST fail the negotiation if: ...
|
||||
* - the transaction does not share a common input with
|
||||
* all previous funding transactions
|
||||
* - the transaction does not share at least one input with
|
||||
* each previous funding transaction
|
||||
*/
|
||||
list_for_each(&channel->inflights, inflight, list) {
|
||||
/* Remove every non-matching input from set */
|
||||
|
@ -2338,9 +2338,9 @@ static void handle_validate_rbf(struct subd *dualopend,
|
|||
assert(inflight);
|
||||
last_fee = psbt_compute_fee(inflight->funding_psbt);
|
||||
|
||||
/* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
/* BOLT #2:
|
||||
* The receiving node: ...
|
||||
* - if is an RBF attempt:
|
||||
* - if this is an RBF attempt:
|
||||
* - MUST fail the negotiation if:
|
||||
* - the transaction's total fees is less than the last
|
||||
* successfully negotiated transaction's fees
|
||||
|
|
|
@ -57,14 +57,14 @@ enum tx_msgs {
|
|||
};
|
||||
|
||||
/*
|
||||
* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
* BOLT #2:
|
||||
* The maximum inputs and outputs are capped at 252. This effectively fixes
|
||||
* the byte size of the input and output counts on the transaction to one (1).
|
||||
*/
|
||||
#define MAX_TX_MSG_RCVD (1 << 12)
|
||||
|
||||
/*
|
||||
* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
* BOLT #2:
|
||||
* The receiving node: ...
|
||||
* - MUST fail the negotiation if: ...
|
||||
* - there are more than 252 inputs
|
||||
|
@ -582,11 +582,11 @@ static char *validate_inputs(struct state *state,
|
|||
struct tx_state *tx_state,
|
||||
enum tx_role role_to_validate)
|
||||
{
|
||||
/* BOLT-18195c86294f503ffd2f11563250c854a50bfa51 #2:
|
||||
/* BOLT #2:
|
||||
* Upon receipt of consecutive `tx_complete`s, the receiving node:
|
||||
* ...
|
||||
* - if it has sent `require_confirmed_inputs` in `open_channel2`
|
||||
* or `accept_channel2`:
|
||||
* - if it has sent `require_confirmed_inputs` in `open_channel2`,
|
||||
* `accept_channel2`, `tx_init_rbf` or `tx_ack_rbf`:
|
||||
* - MUST fail the negotiation if:
|
||||
* - one of the inputs added by the other peer is unconfirmed
|
||||
*/
|
||||
|
@ -613,7 +613,7 @@ static void set_reserve(struct tx_state *tx_state,
|
|||
{
|
||||
struct amount_sat reserve, dust_limit;
|
||||
|
||||
/* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
/* BOLT #2:
|
||||
*
|
||||
* Instead, the channel reserve is fixed at 1% of the total
|
||||
* channel balance (`open_channel2`.`funding_satoshis` +
|
||||
|
@ -637,7 +637,7 @@ static void set_reserve(struct tx_state *tx_state,
|
|||
|
||||
static bool is_openers(const struct wally_map *unknowns)
|
||||
{
|
||||
/* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
/* BOLT #2:
|
||||
* The sending node: ...
|
||||
* - if is the *initiator*:
|
||||
* - MUST send even `serial_id`s
|
||||
|
@ -689,7 +689,7 @@ static char *check_balances(const tal_t *ctx,
|
|||
size_t accepter_weight = 0;
|
||||
|
||||
|
||||
/* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
/* BOLT #2:
|
||||
*
|
||||
* The *initiator* is responsible for paying the fees for the
|
||||
* following fields, to be referred to as the `common fields`.
|
||||
|
@ -709,7 +709,7 @@ static char *check_balances(const tal_t *ctx,
|
|||
&state->their_funding_pubkey);
|
||||
|
||||
/*
|
||||
* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
* BOLT #2:
|
||||
* The receiving node: ...
|
||||
* - MUST fail the negotiation if: ...
|
||||
* - there are more than 252 inputs
|
||||
|
@ -721,7 +721,7 @@ static char *check_balances(const tal_t *ctx,
|
|||
tx_state->psbt->num_inputs,
|
||||
MAX_FUNDING_INPUTS);
|
||||
/*
|
||||
* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
* BOLT #2:
|
||||
* The receiving node: ...
|
||||
* - MUST fail the negotiation if: ...
|
||||
* - there are more than 252 outputs
|
||||
|
@ -748,7 +748,7 @@ static char *check_balances(const tal_t *ctx,
|
|||
tx_state->psbt);
|
||||
}
|
||||
|
||||
/* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
/* BOLT #2:
|
||||
*
|
||||
* Upon receipt of consecutive `tx_complete`s, the receiving
|
||||
* node:
|
||||
|
@ -768,7 +768,7 @@ static char *check_balances(const tal_t *ctx,
|
|||
output_val)),
|
||||
tx_state->psbt);
|
||||
|
||||
/* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
/* BOLT #2:
|
||||
*
|
||||
* Upon receipt of consecutive `tx_complete`s, the receiving
|
||||
* node:
|
||||
|
@ -781,7 +781,7 @@ static char *check_balances(const tal_t *ctx,
|
|||
return insufficient_err_msg(ctx, "funding output is dust",
|
||||
tx_state->psbt);
|
||||
} else {
|
||||
/* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
/* BOLT #2:
|
||||
*
|
||||
* Upon receipt of consecutive `tx_complete`s, the receiving
|
||||
* node:
|
||||
|
@ -858,13 +858,12 @@ static char *check_balances(const tal_t *ctx,
|
|||
tx_state->psbt);
|
||||
}
|
||||
|
||||
/* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
/* BOLT #2:
|
||||
* The receiving node:
|
||||
* ...
|
||||
* - MUST fail the negotiation if:
|
||||
* ...
|
||||
* - the `sats` amount is less than or equal to
|
||||
* the `dust_limit`
|
||||
* - the `sats` amount is less than the `dust_limit`
|
||||
*/
|
||||
if (is_dust(tx_state, amt))
|
||||
return insufficient_err_msg(ctx, "output is dust",
|
||||
|
@ -893,7 +892,7 @@ static char *check_balances(const tal_t *ctx,
|
|||
}
|
||||
}
|
||||
|
||||
/* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
/* BOLT #2:
|
||||
* The receiving node:
|
||||
* ...
|
||||
* - MUST fail the negotiation if:
|
||||
|
@ -917,12 +916,12 @@ static char *check_balances(const tal_t *ctx,
|
|||
|
||||
}
|
||||
|
||||
/* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
/* BOLT #2:
|
||||
* The receiving node: ...
|
||||
* - MUST fail the negotiation if:
|
||||
* ...
|
||||
* - the peer's paid feerate does not meet or exceed the
|
||||
* agreed `feerate`, (based on the `minimum fee`).
|
||||
* agreed `feerate` (based on the `minimum fee`).
|
||||
* - if is the *non-initiator*:
|
||||
* - the *initiator*'s fees do not cover the `common` fields
|
||||
*/
|
||||
|
@ -948,12 +947,12 @@ static char *check_balances(const tal_t *ctx,
|
|||
tx_state->psbt);
|
||||
}
|
||||
|
||||
/* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
/* BOLT #2:
|
||||
* The receiving node: ...
|
||||
* - MUST fail the negotiation if:
|
||||
* ...
|
||||
* - the peer's paid feerate does not meet or exceed the
|
||||
* agreed `feerate`, (based on the `minimum fee`).
|
||||
* agreed `feerate` (based on the `minimum fee`).
|
||||
*/
|
||||
accepter_fee = amount_tx_fee(feerate_per_kw_funding,
|
||||
accepter_weight);
|
||||
|
@ -1526,7 +1525,7 @@ static void handle_tx_abort(struct state *state, u8 *msg)
|
|||
const char *desc;
|
||||
|
||||
/*
|
||||
* BOLT-07cc0edc791aff78398a48fc31ee23b45374d8d9 #2:
|
||||
* BOLT #2:
|
||||
*
|
||||
* Echoing back `tx_abort` allows the peer to ack
|
||||
* that they've seen the abort message, permitting
|
||||
|
@ -1755,7 +1754,7 @@ static bool run_tx_interactive(struct state *state,
|
|||
check_channel_id(state, &cid, &state->channel_id);
|
||||
|
||||
/*
|
||||
* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
* BOLT #2:
|
||||
* The receiving node: ...
|
||||
* - MUST fail the negotiation if: ...
|
||||
* - if has received 4096 `tx_add_input`
|
||||
|
@ -1768,7 +1767,7 @@ static bool run_tx_interactive(struct state *state,
|
|||
}
|
||||
|
||||
/*
|
||||
* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
* BOLT #2:
|
||||
* The receiving node: ...
|
||||
* - MUST fail the negotiation if: ...
|
||||
* - the `serial_id` has the wrong parity
|
||||
|
@ -1780,7 +1779,7 @@ static bool run_tx_interactive(struct state *state,
|
|||
return false;
|
||||
}
|
||||
/*
|
||||
* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
* BOLT #2:
|
||||
* The receiving node: ...
|
||||
* - MUST fail the negotiation if: ...
|
||||
* - the `serial_id` is already included in
|
||||
|
@ -1825,9 +1824,9 @@ static bool run_tx_interactive(struct state *state,
|
|||
}
|
||||
|
||||
/*
|
||||
* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
* BOLT #2:
|
||||
* The receiving node: ...
|
||||
* - MUST fail the negotiation if:
|
||||
* - MUST fail the negotiation if:...
|
||||
* - the `prevtx` and `prevtx_vout` are
|
||||
* identical to a previously added (and not
|
||||
* removed) input's
|
||||
|
@ -1843,7 +1842,7 @@ static bool run_tx_interactive(struct state *state,
|
|||
}
|
||||
|
||||
/*
|
||||
* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
* BOLT #2:
|
||||
* The receiving node:
|
||||
* - MUST add all received inputs to the transaction
|
||||
*/
|
||||
|
@ -1891,7 +1890,7 @@ static bool run_tx_interactive(struct state *state,
|
|||
|
||||
check_channel_id(state, &cid, &state->channel_id);
|
||||
|
||||
/* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
/* BOLT #2:
|
||||
* The receiving node: ...
|
||||
* - MUST fail the negotiation if: ...
|
||||
* - the input or output identified by the
|
||||
|
@ -1905,7 +1904,7 @@ static bool run_tx_interactive(struct state *state,
|
|||
}
|
||||
|
||||
|
||||
/* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
/* BOLT #2:
|
||||
* The receiving node: ...
|
||||
* - MUST fail the negotiation if: ...
|
||||
* - the `serial_id` does not correspond
|
||||
|
@ -1937,7 +1936,7 @@ static bool run_tx_interactive(struct state *state,
|
|||
check_channel_id(state, &cid, &state->channel_id);
|
||||
|
||||
/*
|
||||
* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
* BOLT #2:
|
||||
* The receiving node: ...
|
||||
* - MUST fail the negotiation if: ...
|
||||
* - it has received 4096 `tx_add_output`
|
||||
|
@ -1951,7 +1950,7 @@ static bool run_tx_interactive(struct state *state,
|
|||
return false;
|
||||
}
|
||||
|
||||
/* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
/* BOLT #2:
|
||||
* The receiving node: ...
|
||||
* - MUST fail the negotiation if: ...
|
||||
* - the `serial_id` has the wrong parity
|
||||
|
@ -1963,7 +1962,7 @@ static bool run_tx_interactive(struct state *state,
|
|||
return false;
|
||||
}
|
||||
|
||||
/* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
/* BOLT #2:
|
||||
* The receiving node: ...
|
||||
* - MUST fail the negotiation if: ...
|
||||
* - the `serial_id` is already included
|
||||
|
@ -1976,7 +1975,7 @@ static bool run_tx_interactive(struct state *state,
|
|||
}
|
||||
amt = amount_sat(value);
|
||||
|
||||
/* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
/* BOLT #2:
|
||||
* The receiving node: ...
|
||||
* - MAY fail the negotiation if `script`
|
||||
* is non-standard */
|
||||
|
@ -1999,7 +1998,7 @@ static bool run_tx_interactive(struct state *state,
|
|||
|
||||
check_channel_id(state, &cid, &state->channel_id);
|
||||
|
||||
/* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
/* BOLT #2:
|
||||
* The receiving node: ...
|
||||
* - MUST fail the negotiation if: ...
|
||||
* - the input or output identified by the
|
||||
|
@ -2011,7 +2010,7 @@ static bool run_tx_interactive(struct state *state,
|
|||
return false;
|
||||
}
|
||||
|
||||
/* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
/* BOLT #2:
|
||||
* The receiving node: ...
|
||||
* - MUST fail the negotiation if: ...
|
||||
* - the `serial_id` does not correspond to a
|
||||
|
@ -2405,10 +2404,10 @@ static void accepter_start(struct state *state, const u8 *oc2_msg)
|
|||
else
|
||||
state->upfront_shutdown_script[REMOTE] = NULL;
|
||||
|
||||
/* BOLT-* #2
|
||||
* If the peer's revocation basepoint is unknown (e.g.
|
||||
* `open_channel2`), a temporary `channel_id` should be found
|
||||
* by using a zeroed out basepoint for the unknown peer.
|
||||
/* BOLT #2:
|
||||
* When sending `open_channel2`, the peer's revocation basepoint is unknown.
|
||||
* A `temporary_channel_id` must be computed by using a zeroed out basepoint
|
||||
* for the non-initiator.
|
||||
*/
|
||||
derive_tmp_channel_id(&state->channel_id, /* Temporary! */
|
||||
&state->their_points.revocation);
|
||||
|
@ -2697,7 +2696,7 @@ static void accepter_start(struct state *state, const u8 *oc2_msg)
|
|||
state->our_funding_pubkey,
|
||||
tx_state->blockheight);
|
||||
|
||||
/* BOLT-18195c86294f503ffd2f11563250c854a50bfa51 #2:
|
||||
/* BOLT #2:
|
||||
*
|
||||
* The sending node may require the other participant to
|
||||
* only use confirmed inputs. This ensures that the sending
|
||||
|
@ -3009,10 +3008,10 @@ static void opener_start(struct state *state, u8 *msg)
|
|||
if (requested_lease)
|
||||
state->requested_lease = tal_steal(state, requested_lease);
|
||||
|
||||
/* BOLT-* #2
|
||||
* If the peer's revocation basepoint is unknown (e.g.
|
||||
* `open_channel2`), a temporary `channel_id` should be found
|
||||
* by using a zeroed out basepoint for the unknown peer.
|
||||
/* BOLT #2:
|
||||
* When sending `open_channel2`, the peer's revocation basepoint is unknown.
|
||||
* A `temporary_channel_id` must be computed by using a zeroed out basepoint
|
||||
* for the non-initiator.
|
||||
*/
|
||||
derive_tmp_channel_id(&state->channel_id,
|
||||
&state->our_points.revocation);
|
||||
|
@ -3038,7 +3037,7 @@ static void opener_start(struct state *state, u8 *msg)
|
|||
open_tlv->request_funds->blockheight = tx_state->blockheight;
|
||||
}
|
||||
|
||||
/* BOLT-18195c86294f503ffd2f11563250c854a50bfa51 #2:
|
||||
/* BOLT #2:
|
||||
*
|
||||
* The sending node may require the other participant to
|
||||
* only use confirmed inputs. This ensures that the sending
|
||||
|
@ -3313,7 +3312,7 @@ static void opener_start(struct state *state, u8 *msg)
|
|||
}
|
||||
}
|
||||
|
||||
/* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
/* BOLT #2:
|
||||
* The sending node:
|
||||
* - if is the *opener*:
|
||||
* - MUST send at least one `tx_add_output`, which
|
||||
|
@ -3414,7 +3413,7 @@ static void rbf_wrap_up(struct state *state,
|
|||
bool aborted;
|
||||
u8 *msg;
|
||||
|
||||
/* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
|
||||
/* BOLT #2:
|
||||
* The sending node:
|
||||
* - if is the *opener*:
|
||||
* - MUST send at least one `tx_add_output`, which contains the
|
||||
|
@ -4000,7 +3999,7 @@ static void do_reconnect_dance(struct state *state)
|
|||
|
||||
/* We always send reconnect/reestablish */
|
||||
|
||||
/* BOLT-e299850cb5ebd8bd9c55763bbc498fcdf94a9567 #2:
|
||||
/* BOLT #2:
|
||||
*
|
||||
* - if it has sent `commitment_signed` for an
|
||||
* interactive transaction construction but it has
|
||||
|
@ -4068,7 +4067,7 @@ static void do_reconnect_dance(struct state *state)
|
|||
open_err_fatal(state, "Bad reestablish commitment_number:"
|
||||
"%"PRIu64" vs %d", next_commitment_number, 1);
|
||||
|
||||
/* BOLT-e299850cb5ebd8bd9c55763bbc498fcdf94a9567 #2:
|
||||
/* BOLT #2:
|
||||
* A receiving node:
|
||||
* - if `next_funding_txid` is set:
|
||||
* - if `next_funding_txid` matches the latest interactive funding transaction:
|
||||
|
|
|
@ -198,11 +198,11 @@ bool extract_channel_id(const u8 *in_pkt, struct channel_id *channel_id)
|
|||
* * [`32*byte`:`temporary_channel_id`]
|
||||
*/
|
||||
case WIRE_OPEN_CHANNEL2:
|
||||
/* BOLT-dualfund #2:
|
||||
/* BOLT #2:
|
||||
* 1. type: 64 (`open_channel2`)
|
||||
* 2. data:
|
||||
* * [`chain_hash`:`chain_hash`]
|
||||
* * [`channel_id`:`zerod_channel_id`]
|
||||
* * [`channel_id`:`temporary_channel_id`]
|
||||
*/
|
||||
|
||||
/* Skip over chain_hash */
|
||||
|
@ -210,43 +210,43 @@ bool extract_channel_id(const u8 *in_pkt, struct channel_id *channel_id)
|
|||
|
||||
/* These have them at the start */
|
||||
case WIRE_TX_ADD_INPUT:
|
||||
/* BOLT-dualfund #2:
|
||||
/* BOLT #2:
|
||||
* 1. type: 66 (`tx_add_input`)
|
||||
* 2. data:
|
||||
* * [`channel_id`:`channel_id`]
|
||||
*/
|
||||
case WIRE_TX_ADD_OUTPUT:
|
||||
/* BOLT-dualfund #2:
|
||||
/* BOLT #2:
|
||||
* 1. type: 67 (`tx_add_output`)
|
||||
* 2. data:
|
||||
* * [`channel_id`:`channel_id`]
|
||||
*/
|
||||
case WIRE_TX_REMOVE_INPUT:
|
||||
/* BOLT-dualfund #2:
|
||||
/* BOLT #2:
|
||||
* 1. type: 68 (`tx_remove_input`)
|
||||
* 2. data:
|
||||
* * [`channel_id`:`channel_id`]
|
||||
*/
|
||||
case WIRE_TX_REMOVE_OUTPUT:
|
||||
/* BOLT-dualfund #2:
|
||||
/* BOLT #2:
|
||||
* 1. type: 69 (`tx_remove_output`)
|
||||
* 2. data:
|
||||
* * [`channel_id`:`channel_id`]
|
||||
*/
|
||||
case WIRE_TX_COMPLETE:
|
||||
/* BOLT-dualfund #2:
|
||||
/* BOLT #2:
|
||||
* 1. type: 70 (`tx_complete`)
|
||||
* 2. data:
|
||||
* * [`channel_id`:`channel_id`]
|
||||
*/
|
||||
case WIRE_TX_SIGNATURES:
|
||||
/* BOLT-dualfund #2:
|
||||
/* BOLT #2:
|
||||
* 1. type: 71 (`tx_signatures`)
|
||||
* 2. data:
|
||||
* * [`channel_id`:`channel_id`]
|
||||
*/
|
||||
case WIRE_TX_ABORT:
|
||||
/* BOLT-dualfund #2:
|
||||
/* BOLT #2:
|
||||
* 1. type: 74 (`tx_abort`)
|
||||
* 2. data:
|
||||
* * [`channel_id`:`channel_id`]
|
||||
|
@ -276,19 +276,19 @@ bool extract_channel_id(const u8 *in_pkt, struct channel_id *channel_id)
|
|||
* * [`channel_id`:`channel_id`]
|
||||
*/
|
||||
case WIRE_ACCEPT_CHANNEL2:
|
||||
/* BOLT-dualfund #2:
|
||||
/* BOLT #2:
|
||||
* 1. type: 65 (`accept_channel2`)
|
||||
* 2. data:
|
||||
* * [`channel_id`:`channel_id`]
|
||||
* * [`channel_id`:`temporary_channel_id`]
|
||||
*/
|
||||
case WIRE_TX_INIT_RBF:
|
||||
/* BOLT-dualfund #2:
|
||||
/* BOLT #2:
|
||||
* 1. type: 72 (`tx_init_rbf`)
|
||||
* 2. data:
|
||||
* * [`channel_id`:`channel_id`]
|
||||
*/
|
||||
case WIRE_TX_ACK_RBF:
|
||||
/* BOLT-dualfund #2:
|
||||
/* BOLT #2:
|
||||
* 1. type: 73 (`tx_ack_rbf`)
|
||||
* 2. data:
|
||||
* * [`channel_id`:`channel_id`]
|
||||
|
|
Loading…
Add table
Reference in a new issue