Browse Source

BOLT: Update text to latest commit.

This brings us up to 955e874acc535ab2c74c1cf0eab61896ea4224ff in
https://github.com/lightningnetwork/lightning-rfc

This doesn't actually change anything; the only actual change is held back
for the next commit.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 7 years ago
committed by Christian Decker
parent
commit
fea412dd94
  1. 8
      lightningd/channel/channel.c
  2. 46
      lightningd/closing/closing.c
  3. 5
      lightningd/keyset.c
  4. 2
      lightningd/sphinx.h
  5. 2
      wire/peer_wire.h

8
lightningd/channel/channel.c

@ -1545,7 +1545,7 @@ again:
/* BOLT #2: /* BOLT #2:
* *
* If `next_remote_revocation_number` is equal to the commitment * If `next_remote_revocation_number` is equal to the commitment
* number of the last `revoke_and_ack` the receiving node has sent, it * number of the last `revoke_and_ack` the receiving node has sent and the receiving node has not already received a `closing_signed`, it
* MUST re-send the `revoke_and_ack`, otherwise if * MUST re-send the `revoke_and_ack`, otherwise if
* `next_remote_revocation_number` is not equal to one greater than * `next_remote_revocation_number` is not equal to one greater than
* the commitment number of the last `revoke_and_ack` the receiving * the commitment number of the last `revoke_and_ack` the receiving
@ -1614,9 +1614,11 @@ again:
/* BOLT #2: /* BOLT #2:
* *
* On reconnection if the node has sent a previous `shutdown` it MUST * On reconnection if the node has sent a previous `closing_signed` it
* retransmit it * MUST send another `closing_signed`, otherwise if the node has sent
* a previous `shutdown` it MUST retransmit it.
*/ */
/* If we had sent `closing_signed`, we'd be in closingd. */
maybe_send_shutdown(peer); maybe_send_shutdown(peer);
/* Corner case: we didn't send shutdown before because update_add_htlc /* Corner case: we didn't send shutdown before because update_add_htlc

46
lightningd/closing/closing.c

@ -135,7 +135,7 @@ again:
/* BOLT #2: /* BOLT #2:
* *
* On reconnection if the node has sent a previous `closing_signed` it * On reconnection if the node has sent a previous `closing_signed` it
* MUST then retransmit the last `closing_signed` * MUST send another `closing_signed`
*/ */
/* Since we always transmit closing_signed immediately, if /* Since we always transmit closing_signed immediately, if
@ -218,10 +218,12 @@ int main(int argc, char *argv[])
* Nodes SHOULD send a `closing_signed` message after `shutdown` has * Nodes SHOULD send a `closing_signed` message after `shutdown` has
* been received and no HTLCs remain in either commitment transaction. * been received and no HTLCs remain in either commitment transaction.
*/ */
/* BOLT #2: /* BOLT #2:
* *
* On reconnection, ... if the node has sent a previous * On reconnection, ... if the node has sent a previous
* `closing_signed` it MUST then retransmit the last `closing_signed`. * `closing_signed` it MUST send another `closing_signed`, otherwise
* if the node has sent a previous `shutdown` it MUST retransmit it.
*/ */
for (;;) { for (;;) {
const tal_t *tmpctx = tal_tmpctx(ctx); const tal_t *tmpctx = tal_tmpctx(ctx);
@ -231,11 +233,8 @@ int main(int argc, char *argv[])
/* BOLT #2: /* BOLT #2:
* *
* The sender MUST set `signature` to the Bitcoin signature of * The sender MUST set `signature` to the Bitcoin signature of
* the close transaction with the node responsible for paying * the close transaction as specified in [BOLT
* the bitcoin fee paying `fee_satoshis`, then removing any * #3](03-transactions.md#closing-transaction).
* output which is below its own `dust_limit_satoshis`. The
* sender MAY then also eliminate its own output from the
* mutual close transaction.
*/ */
tx = close_tx(tmpctx, scriptpubkey, tx = close_tx(tmpctx, scriptpubkey,
&funding_txid, &funding_txid,
@ -243,10 +242,12 @@ int main(int argc, char *argv[])
funding_satoshi, funding_satoshi,
satoshi_out, funder, sent_fee, our_dust_limit); satoshi_out, funder, sent_fee, our_dust_limit);
/* BOLT #2: /* BOLT #3:
* *
* The sender MAY then also eliminate its own output from the * ## Closing Transaction
* mutual close transaction. *...
* Each node offering a signature... MAY also eliminate its
* own output.
*/ */
/* (We don't do this). */ /* (We don't do this). */
sign_tx_input(tx, 0, NULL, funding_wscript, sign_tx_input(tx, 0, NULL, funding_wscript,
@ -310,11 +311,10 @@ int main(int argc, char *argv[])
/* BOLT #2: /* BOLT #2:
* *
* The receiver MUST check `signature` is valid for either the * The receiver MUST check `signature` is valid for either
* close transaction with the given `fee_satoshis` as detailed * variant of close transaction specified in [BOLT
* above and its own `dust_limit_satoshis` OR that same * #3](03-transactions.md#closing-transaction), and MUST fail
* transaction with the sender's output eliminated, and MUST * the connection if it is not.
* fail the connection if it is not.
*/ */
tx = close_tx(tmpctx, scriptpubkey, tx = close_tx(tmpctx, scriptpubkey,
&funding_txid, &funding_txid,
@ -334,6 +334,14 @@ int main(int argc, char *argv[])
trimming_satoshi_out[REMOTE] = 0; trimming_satoshi_out[REMOTE] = 0;
trimming_satoshi_out[LOCAL] = satoshi_out[LOCAL]; trimming_satoshi_out[LOCAL] = satoshi_out[LOCAL];
/* BOLT #3:
*
* Each node offering a signature MUST subtract the
* fee given by `fee_satoshis` from the output to the
* funder; it MUST then remove any output below its
* own `dust_limit_satoshis`, and MAY also eliminate
* its own output.
*/
trimmed = close_tx(tmpctx, scriptpubkey, trimmed = close_tx(tmpctx, scriptpubkey,
&funding_txid, &funding_txid,
funding_txout, funding_txout,
@ -392,9 +400,9 @@ int main(int argc, char *argv[])
/* BOLT #2: /* BOLT #2:
* *
* Once a node has sent or received a `closing_signed` with * If `fee_satoshis` is equal to its previously sent
* matching `fee_satoshis` it SHOULD close the connection and * `fee_satoshis`, the receiver SHOULD sign and broadcast the
* SHOULD sign and broadcast the final closing transaction. * final closing transaction and MAY close the connection.
*/ */
if (received_fee == sent_fee) if (received_fee == sent_fee)
break; break;
@ -433,7 +441,7 @@ int main(int argc, char *argv[])
/* BOLT #2: /* BOLT #2:
* *
* ...otherwise it SHOULD propose a value strictly between the * ...otherwise it MUST propose a value strictly between the
* received `fee_satoshis` and its previously-sent * received `fee_satoshis` and its previously-sent
* `fee_satoshis`. * `fee_satoshis`.
*/ */

5
lightningd/keyset.c

@ -46,11 +46,6 @@ bool derive_keyset(const struct pubkey *per_commitment_point,
* a new commitment for a remote node, it uses its own * a new commitment for a remote node, it uses its own
* `revocation_basepoint` and the remote node's `per_commitment_point` * `revocation_basepoint` and the remote node's `per_commitment_point`
* to derive a new `revocationkey` for the commitment. * to derive a new `revocationkey` for the commitment.
*
* per_commitment_point... is used to derive the revocation key from
* the remote node's `revocation_basepoint`:
*
* revocationkey = revocation_basepoint * SHA256(revocation_basepoint || per_commitment_point) + per_commitment_point*SHA256(per_commitment_point || revocation_basepoint)
*/ */
if (!derive_revocation_key(other_revocation_basepoint, if (!derive_revocation_key(other_revocation_basepoint,
per_commitment_point, per_commitment_point,

2
lightningd/sphinx.h

@ -58,7 +58,7 @@ enum route_next_case {
* *
* 1. type: `per_hop` (for `realm` 0) * 1. type: `per_hop` (for `realm` 0)
* 2. data: * 2. data:
* * [`8`:`channel_id`] * * [`8`:`short_channel_id`]
* * [`8`:`amt_to_forward`] * * [`8`:`amt_to_forward`]
* * [`4`:`outgoing_cltv_value`] * * [`4`:`outgoing_cltv_value`]
* * [`12`:`padding`] * * [`12`:`padding`]

2
wire/peer_wire.h

@ -34,7 +34,7 @@ bool is_gossip_msg(const u8 *cursor);
* to perform an initial sync by setting the `initial_routing_sync` * to perform an initial sync by setting the `initial_routing_sync`
* flags in the `init` message. The endpoint SHOULD set the * flags in the `init` message. The endpoint SHOULD set the
* `initial_routing_sync` flag if it requires a full copy of the other * `initial_routing_sync` flag if it requires a full copy of the other
* endpoint's routing state. Upon receiving an init message with the * endpoint's routing state. Upon receiving an `init` message with the
* `initial_routing_sync` flag set the node sends `channel_announcement`s, * `initial_routing_sync` flag set the node sends `channel_announcement`s,
* `channel_update`s and `node_announcement`s for all known channels and * `channel_update`s and `node_announcement`s for all known channels and
* nodes as if they were just received. * nodes as if they were just received.

Loading…
Cancel
Save