Browse Source

BOLT: fee requirements update.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 9 years ago
parent
commit
08a910b06e
  1. 8
      daemon/packets.c
  2. 4
      daemon/peer.c

8
daemon/packets.c

@ -647,18 +647,14 @@ Pkt *accept_pkt_htlc_add(struct peer *peer, const Pkt *pkt)
/* BOLT #2: /* BOLT #2:
* *
* A node MUST NOT offer `amount_msat` it cannot pay for in * A node MUST NOT offer `amount_msat` it cannot pay for in
* both commitment transactions at the current `fee_rate` (see * the remote commitment transaction at the current `fee_rate` (see
* "Fee Calculation" ). A node SHOULD fail the connection if * "Fee Calculation" ). A node SHOULD fail the connection if
* this occurs. * this occurs.
*/ */
/* FIXME: This is wrong! We may have already added more txs to
* them.staging_cstate, driving that fee up.
* We should check against the last version they acknowledged. */
if (!cstate_add_htlc(peer->local.staging_cstate, htlc, THEIRS)) { if (!cstate_add_htlc(peer->local.staging_cstate, htlc, THEIRS)) {
tal_free(htlc); tal_free(htlc);
return pkt_err(peer, "Cannot afford %"PRIu64" milli-satoshis" return pkt_err(peer, "Cannot afford %"PRIu64" milli-satoshis"
" in your commitment tx", " in our commitment tx",
u->amount_msat); u->amount_msat);
} }

4
daemon/peer.c

@ -739,7 +739,7 @@ struct htlc *command_htlc_add(struct peer *peer, u64 msatoshis,
/* BOLT #2: /* BOLT #2:
* *
* A node MUST NOT offer `amount_msat` it cannot pay for in * A node MUST NOT offer `amount_msat` it cannot pay for in
* both commitment transactions at the current `fee_rate` * the remote commitment transaction at the current `fee_rate`
*/ */
cstate = copy_cstate(peer, peer->remote.staging_cstate); cstate = copy_cstate(peer, peer->remote.staging_cstate);
if (!cstate_add_htlc(cstate, htlc, OURS)) { if (!cstate_add_htlc(cstate, htlc, OURS)) {
@ -1534,7 +1534,7 @@ static void resolve_cheating(struct peer *peer)
/* BOLT #onchain: /* BOLT #onchain:
* *
* The node MAY use a single transaction to *resolve* all the * The node MAY use a single transaction to *resolve* all the
* outputs; due to the 450 HTLC-per-party limit (See BOLT #2: * outputs; due to the 300 HTLC-per-party limit (See BOLT #2:
* 3.2. Adding an HTLC) this can be done within a standard * 3.2. Adding an HTLC) this can be done within a standard
* transaction. * transaction.
*/ */

Loading…
Cancel
Save