Browse Source

Update to lightning-rfc to dc0b529161561c6be3ff53c5f8574b23c3305a04

Only minor changes, but I add some more spec text to
lightningd/test/run-commit_tx.c to be sure to catch if it changes
again.

One reference isn't upstream yet, so had to be commented out.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 8 years ago
parent
commit
5dc0402a44
  1. 6
      lightningd/channel.c
  2. 6
      lightningd/opening/opening.c
  3. 4
      lightningd/peer_control.c
  4. 40
      lightningd/test/run-channel.c
  5. 25
      lightningd/test/run-commit_tx.c

6
lightningd/channel.c

@ -330,9 +330,9 @@ 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 `max-htlc-value-in-flight-msat` in HTLCs to
* its local commitment transaction. */
* 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
* 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;
goto out;

6
lightningd/opening/opening.c

@ -522,7 +522,7 @@ static u8 *recv_channel(struct state *state, const struct points *ours,
"Parsing open_channel %s",
tal_hex(peer_msg, peer_msg));
/* BOLT #2:
/* BOLT #2 FIXME:
*
* The receiving node ... MUST fail the channel if `funding-satoshis`
* is greater than or equal to 2^24 */
@ -534,7 +534,7 @@ static u8 *recv_channel(struct state *state, const struct points *ours,
/* BOLT #2:
*
* The receiving node ... MUST fail the channel if `push-msat` is
* greater than `funding-satoshis` * 1000.
* greater than `funding-amount` * 1000.
*/
if (state->push_msat > state->funding_satoshis * 1000)
peer_failed(PEER_FD, &state->cs, NULL, WIRE_OPENING_PEER_BAD_FUNDING,
@ -542,7 +542,7 @@ static u8 *recv_channel(struct state *state, const struct points *ours,
" too large for funding_satoshis %"PRIu64,
state->push_msat, state->funding_satoshis);
/* BOLT #3:
/* BOLT #2:
*
* The receiver MUST fail the channel if it considers `feerate-per-kw`
* too small for timely processing, or unreasonably large.

4
lightningd/peer_control.c

@ -627,7 +627,7 @@ static void channel_config(struct lightningd *ld,
ours->dust_limit_satoshis = 546;
ours->max_htlc_value_in_flight_msat = UINT64_MAX;
/* BOLT #3:
/* BOLT #2:
*
* The sender SHOULD set `minimum-depth` to an amount where
* the sender considers reorganizations to be low risk.
@ -637,7 +637,7 @@ static void channel_config(struct lightningd *ld,
/* Don't care */
ours->htlc_minimum_msat = 0;
/* BOLT #3:
/* BOLT #2:
*
* The sender SHOULD set `to-self-delay` sufficient to ensure
* the sender can irreversibly spend a commitment transaction

40
lightningd/test/run-channel.c

@ -40,25 +40,25 @@ static struct sha256_double txid_from_hex(const char *hex)
*
* local_feerate_per_kw: 0
* ...
* local_feerate_per_kw: 678
* local_feerate_per_kw: 676
* ...
* local_feerate_per_kw: 679
* local_feerate_per_kw: 677
* ...
* local_feerate_per_kw: 2168
* local_feerate_per_kw: 2161
* ...
* local_feerate_per_kw: 2169
* local_feerate_per_kw: 2162
* ...
* local_feerate_per_kw: 2294
* local_feerate_per_kw: 2291
* ...
* local_feerate_per_kw: 2295
* local_feerate_per_kw: 2292
* ...
* local_feerate_per_kw: 3872
* local_feerate_per_kw: 3866
* ...
* local_feerate_per_kw: 3873
* local_feerate_per_kw: 3867
* ...
* local_feerate_per_kw: 5149
* local_feerate_per_kw: 5133
* ...
* local_feerate_per_kw: 5150
* local_feerate_per_kw: 5134
* ...
* local_feerate_per_kw: 9651180
* ...
@ -68,16 +68,16 @@ static struct sha256_double txid_from_hex(const char *hex)
*/
static u64 feerates[] = {
0,
678,
679,
2168,
2169,
2294,
2295,
3872,
3873,
5149,
5150,
676,
677,
2161,
2162,
2291,
2292,
3866,
3867,
5133,
5134,
9651180,
9651181,
9651936

25
lightningd/test/run-commit_tx.c

@ -358,6 +358,22 @@ static u64 increase(u64 feerate_per_kw)
#else
static u64 increase(u64 feerate_per_kw)
{
/* BOLT #3:
*
* local_feerate_per_kw: 0
* ...
* local_feerate_per_kw: 677
* ...
* local_feerate_per_kw: 2162
* ...
* local_feerate_per_kw: 2292
* ...
* local_feerate_per_kw: 3867
* ...
* local_feerate_per_kw: 5134
* ...
* local_feerate_per_kw: 9651181
*/
const u64 rates[] = { 0, 677, 2162, 2292, 3867, 5134, 9651181 };
size_t i;
@ -876,6 +892,15 @@ int main(void)
continue;
}
/* BOLT #3:
*
* name: commitment tx with fee greater than funder amount
* to_local_msat: 6988000000
* to_remote_msat: 3000000000
* local_feerate_per_kw: 9651936
*/
assert(feerate_per_kw == 9651936);
printf("\n"
"name: commitment tx with fee greater than funder amount\n"
"to_local_msat: %"PRIu64"\n"

Loading…
Cancel
Save