Skip to content

Commit

Permalink
Massive BOLT text underscore and formatting updates.
Browse files Browse the repository at this point in the history
This brings us up to 61b5b3f.

Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell committed Jun 6, 2017
1 parent 87fc343 commit 7389aae
Show file tree
Hide file tree
Showing 22 changed files with 212 additions and 196 deletions.
30 changes: 15 additions & 15 deletions bitcoin/script.c
Original file line number Diff line number Diff line change
Expand Up @@ -627,12 +627,12 @@ u8 **bitcoin_witness_htlc(const tal_t *ctx,
*
* OP_IF
* # Penalty transaction
* <revocation-pubkey>
* <revocationkey>
* OP_ELSE
* `to-self-delay`
* `to_self_delay`
* OP_CSV
* OP_DROP
* <local-delayedkey>
* <local_delayedkey>
* OP_ENDIF
* OP_CHECKSIG
*/
Expand Down Expand Up @@ -660,10 +660,10 @@ u8 **bitcoin_to_local_spend_delayedkey(const tal_t *ctx,
/* BOLT #3:
*
* It is spent by a transaction with `nSequence` field set to
* `to-self-delay` (which can only be valid after that duration has
* `to_self_delay` (which can only be valid after that duration has
* passed), and witness:
*
* <local-delayedsig> 0
* <local_delayedsig> 0
*/
u8 **witness = tal_arr(ctx, u8 *, 3);

Expand All @@ -682,7 +682,7 @@ u8 **bitcoin_to_local_spend_revocation(const tal_t *ctx,
* If a revoked commitment transaction is published, the other party
* can spend this output immediately with the following witness:
*
* <revocation-sig> 1
* <revocation_sig> 1
*/
u8 **witness = tal_arr(ctx, u8 *, 3);

Expand All @@ -702,7 +702,7 @@ u8 **bitcoin_to_local_spend_revocation(const tal_t *ctx,
* key. The output is a P2WSH, with a witness script:
*
* # To you with revocation key
* OP_DUP OP_HASH160 <revocationkey-hash> OP_EQUAL
* OP_DUP OP_HASH160 <RIPEMD160(revocationkey)> OP_EQUAL
* OP_IF
* OP_CHECKSIG
* OP_ELSE
Expand All @@ -712,7 +712,7 @@ u8 **bitcoin_to_local_spend_revocation(const tal_t *ctx,
* OP_DROP 2 OP_SWAP <localkey> 2 OP_CHECKMULTISIG
* OP_ELSE
* # To you with preimage.
* OP_HASH160 <ripemd-of-payment-hash> OP_EQUALVERIFY
* OP_HASH160 <RIPEMD160(payment_hash)> OP_EQUALVERIFY
* OP_CHECKSIG
* OP_ENDIF
* OP_ENDIF
Expand Down Expand Up @@ -767,19 +767,19 @@ u8 *bitcoin_wscript_htlc_offer(const tal_t *ctx,
* payment preimage. The output is a P2WSH, with a witness script:
*
* # To you with revocation key
* OP_DUP OP_HASH160 <revocationkey-hash> OP_EQUAL
* OP_DUP OP_HASH160 <RIPEMD160(revocationkey)> OP_EQUAL
* OP_IF
* OP_CHECKSIG
* OP_ELSE
* <remotekey> OP_SWAP
* OP_SIZE 32 OP_EQUAL
* OP_IF
* # To me via HTLC-success transaction.
* OP_HASH160 <ripemd-of-payment-hash> OP_EQUALVERIFY
* OP_HASH160 <RIPEMD160(payment_hash)> OP_EQUALVERIFY
* 2 OP_SWAP <localkey> 2 OP_CHECKMULTISIG
* OP_ELSE
* # To you after timeout.
* OP_DROP <locktime> OP_CHECKLOCKTIMEVERIFY OP_DROP
* OP_DROP <cltv_expiry> OP_CHECKLOCKTIMEVERIFY OP_DROP
* OP_CHECKSIG
* OP_ENDIF
* OP_ENDIF
Expand Down Expand Up @@ -834,7 +834,7 @@ u8 *bitcoin_wscript_htlc_receive(const tal_t *ctx,
* ## HTLC-Timeout and HTLC-Success Transactions
*
*...
* * `txin[0]` witness stack: `0 <remotesig> <localsig> <payment-preimage>` for HTLC-Success, `0 <remotesig> <localsig> 0` for HTLC-Timeout.
* * `txin[0]` witness stack: `0 <remotesig> <localsig> <payment_preimage>` for HTLC-Success, `0 <remotesig> <localsig> 0` for HTLC-Timeout.
*/
u8 **bitcoin_htlc_offer_spend_timeout(const tal_t *ctx,
const secp256k1_ecdsa_signature *localsig,
Expand Down Expand Up @@ -882,12 +882,12 @@ u8 *bitcoin_wscript_htlc_tx(const tal_t *ctx,
*
* OP_IF
* # Penalty transaction
* <revocation-pubkey>
* <revocationkey>
* OP_ELSE
* `to-self-delay`
* `to_self_delay`
* OP_CSV
* OP_DROP
* <local-delayedkey>
* <local_delayedkey>
* OP_ENDIF
* OP_CHECKSIG
*/
Expand Down
8 changes: 4 additions & 4 deletions daemon/routing.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,9 +551,9 @@ bool add_channel_direction(struct routing_state *rstate,
*
* The following `address descriptor` types are defined:
*
* 1. `0`: padding. data = none (length 0).
* 1. `1`: IPv4. data = `[4:ipv4-addr][2:port]` (length 6)
* 2. `2`: IPv6. data = `[16:ipv6-addr][2:port]` (length 18)
* * `0`: padding. data = none (length 0).
* * `1`: ipv4. data = `[4:ipv4_addr][2:port]` (length 6)
* * `2`: ipv6. data = `[16:ipv6_addr][2:port]` (length 18)
*/

/* FIXME: Don't just take first one, depends whether we have IPv6 ourselves */
Expand Down Expand Up @@ -622,7 +622,7 @@ bool read_ip(const tal_t *ctx, const u8 *addresses, char **hostname,
* used for aligning fields following `addresses`.
*
* The creating node MUST NOT create a type 1 or type 2 address descriptor
* with `port` equal to zero, and SHOULD ensure `ipv4-addr` and `ipv6-addr`
* with `port` equal to zero, and SHOULD ensure `ipv4_addr` and `ipv6_addr`
* are routable addresses. The creating node MUST NOT include more than one
* `address descriptor` of the same type.
*/
Expand Down
2 changes: 1 addition & 1 deletion daemon/sphinx.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ enum route_next_case {
ONION_FORWARD = 1,
};

/* BOLT #4:
/* FIXME-OLD #4:
*
* The format of the per-hop-payload for a version 0 packet is as follows:
```
Expand Down
30 changes: 15 additions & 15 deletions lightningd/channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ enum channel_add_err channel_add_htlc(struct channel *channel,
/* BOLT #2:
*
* A receiving node SHOULD fail the channel if a sending node... sets
* `cltv-expiry` to greater or equal to 500000000.
* `cltv_expiry` to greater or equal to 500000000.
*/
if (!blocks_to_abs_locktime(cltv_expiry, &htlc->expiry))
return CHANNEL_ERR_INVALID_EXPIRY;
Expand All @@ -349,12 +349,12 @@ enum channel_add_err channel_add_htlc(struct channel *channel,
*
* 1. type: 128 (`update_add_htlc`)
* 2. data:
* * [32:channel-id]
* * [8:id]
* * [4:amount-msat]
* * [4:cltv-expiry]
* * [32:payment-hash]
* * [1366:onion-routing-packet]
* * [`32`:`channel_id`]
* * [`8`:`id`]
* * [`4`:`amount_msat`]
* * [`4`:`cltv_expiry`]
* * [`32`:`payment_hash`]
* * [`1366`:`onion_routing_packet`]
*/
htlc->routing = tal_dup_arr(htlc, u8, routing, TOTAL_PACKET_SIZE, 0);

Expand All @@ -379,7 +379,7 @@ enum channel_add_err channel_add_htlc(struct channel *channel,
/* BOLT #2:
*
* A receiving node SHOULD fail the channel if it receives an
* `amount-sat` equal to zero, below its own `htlc-minimum-msat`,
* `amount_msat` equal to zero, below its own `htlc_minimum_msat`,
* or...
*/
if (htlc->msatoshi == 0) {
Expand All @@ -398,7 +398,7 @@ enum channel_add_err channel_add_htlc(struct channel *channel,
/* BOLT #2:
*
* A receiving node SHOULD fail the channel if a sending node
* adds more than its `max-accepted-htlcs` HTLCs to its local
* adds more than its `max_accepted_htlcs` HTLCs to its local
* commitment transaction */
if (tal_count(committed) - tal_count(removing) + tal_count(adding)
> max_accepted_htlcs(channel, recipient)) {
Expand All @@ -413,7 +413,7 @@ enum channel_add_err channel_add_htlc(struct channel *channel,
/* BOLT #2:
*
* A receiving node SHOULD fail the channel if a sending node ... or
* adds more than its `max-htlc-value-in-flight-msat` worth of offered
* adds more than its `max_htlc_value_in_flight_msat` worth of offered
* HTLCs to its local commitment transaction */
if (msat_in_htlcs > max_htlc_value_in_flight_msat(channel, recipient)) {
e = CHANNEL_ERR_MAX_HTLC_VALUE_EXCEEDED;
Expand All @@ -422,8 +422,8 @@ enum channel_add_err channel_add_htlc(struct channel *channel,

/* BOLT #2:
*
* or which the sending node cannot afford at the current `fee-rate`
* while maintaining its channel reserve.
* or which the sending node cannot afford at the current
* `feerate_per_kw` while maintaining its channel reserve.
*/
if (channel->funder == htlc_owner(htlc)) {
u64 feerate = view->feerate_per_kw;
Expand Down Expand Up @@ -498,9 +498,9 @@ enum channel_remove_err channel_fulfill_htlc(struct channel *channel,
sha256(&hash, preimage, sizeof(*preimage));
/* BOLT #2:
*
* A receiving node MUST check that the `payment-preimage` value in
* `update-fulfill_htlc` SHA256 hashes to the corresponding HTLC
* `payment-hash`, and MUST fail the channel if it does not.
* A receiving node MUST check that the `payment_preimage` value in
* `update_fulfill_htlc` SHA256 hashes to the corresponding HTLC
* `payment_hash`, and MUST fail the channel if it does not.
*/
if (!structeq(&hash, &htlc->rhash))
return CHANNEL_ERR_BAD_PREIMAGE;
Expand Down
12 changes: 6 additions & 6 deletions lightningd/channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ struct channel {

/* BOLT #2:
*
* `dust-limit-satoshis` is the threshold below which output should be
* `dust_limit_satoshis` is the threshold below which output should be
* generated for this node's commitment or HTLC transaction */
static inline u64 dust_limit_satoshis(const struct channel *channel,
enum side side)
Expand All @@ -73,7 +73,7 @@ static inline u64 dust_limit_satoshis(const struct channel *channel,
}
/* BOLT #2:
*
* `max-htlc-value-in-inflight-msat` is a cap on total value of
* `max_htlc_value_in_flight_msat` is a cap on total value of
* outstanding HTLCs, which allows a node to limit its exposure to
* HTLCs */
static inline u64 max_htlc_value_in_flight_msat(const struct channel *channel,
Expand All @@ -83,7 +83,7 @@ static inline u64 max_htlc_value_in_flight_msat(const struct channel *channel,
}
/* BOLT #2:
*
* similarly `max-accepted-htlcs` limits the number of outstanding
* similarly `max_accepted_htlcs` limits the number of outstanding
* HTLCs the other node can offer. */
static inline u16 max_accepted_htlcs(const struct channel *channel,
enum side recipient)
Expand All @@ -92,7 +92,7 @@ static inline u16 max_accepted_htlcs(const struct channel *channel,
}
/* BOLT #2:
*
* `channel-reserve-satoshis` is the minimum amount that the other
* `channel_reserve_satoshis` is the minimum amount that the other
* node is to keep as a direct payment. */
static inline u64 channel_reserve_msat(const struct channel *channel,
enum side side)
Expand All @@ -101,7 +101,7 @@ static inline u64 channel_reserve_msat(const struct channel *channel,
}
/* BOLT #2:
*
* `htlc-minimum-msat` indicates the smallest value HTLC this node will accept.
* `htlc_minimum_msat` indicates the smallest value HTLC this node will accept.
*/
static inline u32 htlc_minimum_msat(const struct channel *channel,
enum side recipient)
Expand All @@ -110,7 +110,7 @@ static inline u32 htlc_minimum_msat(const struct channel *channel,
}
/* BOLT #2:
*
* `to-self-delay` is the number of blocks that the other nodes
* `to_self_delay` is the number of blocks that the other nodes
* to-self outputs must be delayed, using `OP_CHECKSEQUENCEVERIFY`
* delays */
static inline u16 to_self_delay(const struct channel *channel, enum side side)
Expand Down
12 changes: 6 additions & 6 deletions lightningd/channel/channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ static void send_commit(struct peer *peer)

/* BOLT #2:
*
* A node MUST include one `htlc-signature` for every HTLC transaction
* A node MUST include one `htlc_signature` for every HTLC transaction
* corresponding to BIP69 lexicographic ordering of the commitment
* transaction.
*/
Expand Down Expand Up @@ -519,7 +519,7 @@ static void handle_peer_commit_sig(struct peer *peer, const u8 *msg)

/* BOLT #2:
*
* A receiving node MUST fail the channel if `num-htlcs` is not equal
* A receiving node MUST fail the channel if `num_htlcs` is not equal
* to the number of HTLC outputs in the local commitment transaction
* once all pending updates are applied.
*/
Expand All @@ -534,7 +534,7 @@ static void handle_peer_commit_sig(struct peer *peer, const u8 *msg)
/* BOLT #2:
*
* A receiving node MUST fail
* the channel if any `htlc-signature` is not valid for the
* the channel if any `htlc_signature` is not valid for the
* corresponding HTLC transaction.
*/
for (i = 0; i < tal_count(htlc_sigs); i++) {
Expand Down Expand Up @@ -701,8 +701,8 @@ static void handle_peer_revoke_and_ack(struct peer *peer, const u8 *msg)

/* BOLT #2:
*
* A receiving node MUST check that `per-commitment-secret` generates
* the previous `per-commitment-point`, and MUST fail if it does
* A receiving node MUST check that `per_commitment_secret` generates
* the previous `per_commitment_point`, and MUST fail if it does
* not.
*/
memcpy(&privkey, &old_commit_secret, sizeof(privkey));
Expand All @@ -727,7 +727,7 @@ static void handle_peer_revoke_and_ack(struct peer *peer, const u8 *msg)

/* BOLT #2:
*
* A receiving node MAY fail if the `per-commitment-secret` was not
* A receiving node MAY fail if the `per_commitment_secret` was not
* generated by the protocol in [BOLT #3]
*/
if (!shachain_add_hash(&peer->their_shachain,
Expand Down
38 changes: 19 additions & 19 deletions lightningd/channel_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,28 @@
*
* 1. type: 32 (`open_channel`)
* 2. data:
* * [32:chain-hash]
* * [32:temporary-channel-id]
* * [8:funding-satoshis]
* * [8:push-msat]
* * [8:dust-limit-satoshis]
* * [8:max-htlc-value-in-flight-msat]
* * [8:channel-reserve-satoshis]
* * [4:htlc-minimum-msat]
* * [4:feerate-per-kw]
* * [2:to-self-delay]
* * [2:max-accepted-htlcs]
* * [`32`:`chain_hash`]
* * [`32`:`temporary_channel_id`]
* * [`8`:`funding_satoshis`]
* * [`8`:`push_msat`]
* * [`8`:`dust_limit_satoshis`]
* * [`8`:`max_htlc_value_in_flight_msat`]
* * [`8`:`channel_reserve_satoshis`]
* * [`4`:`htlc_minimum_msat`]
* * [`4`:`feerate_per_kw`]
* * [`2`:`to_self_delay`]
* * [`2`:`max_accepted_htlcs`]
*...
* 1. type: 33 (`accept_channel`)
* 2. data:
* * [32:temporary-channel-id]
* * [8:dust-limit-satoshis]
* * [8:max-htlc-value-in-flight-msat]
* * [8:channel-reserve-satoshis]
* * [4:minimum-depth]
* * [4:htlc-minimum-msat]
* * [2:to-self-delay]
* * [2:max-accepted-htlcs]
* * [`32`:`temporary_channel_id`]
* * [`8`:`dust_limit_satoshis`]
* * [`8`:`max_htlc_value_in_flight_msat`]
* * [`8`:`channel_reserve_satoshis`]
* * [`4`:`minimum_depth`]
* * [`4`:`htlc_minimum_msat`]
* * [`2`:`to_self_delay`]
* * [`2`:`max_accepted_htlcs`]
*/
struct channel_config {
u64 dust_limit_satoshis;
Expand Down
Loading

0 comments on commit 7389aae

Please sign in to comment.