mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 15:44:21 +01:00
htlc_add: only limit is on receiving side.
BOLT has been updated, so update code and comments. The receiving side check is sufficient, as the limit is per-offerer, and that's the only way the HTLCs get back to the offerer's side. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -619,10 +619,9 @@ Pkt *accept_pkt_htlc_add(struct peer *peer, const Pkt *pkt)
|
|||||||
/* BOLT #2:
|
/* BOLT #2:
|
||||||
*
|
*
|
||||||
* A node MUST NOT add a HTLC if it would result in it
|
* A node MUST NOT add a HTLC if it would result in it
|
||||||
* offering more than 300 HTLCs in either commitment transaction.
|
* offering more than 300 HTLCs in the remote commitment transaction.
|
||||||
*/
|
*/
|
||||||
if (tal_count(peer->remote.staging_cstate->side[THEIRS].htlcs) == 300
|
if (tal_count(peer->remote.staging_cstate->side[THEIRS].htlcs) == 300)
|
||||||
|| tal_count(peer->local.staging_cstate->side[THEIRS].htlcs) == 300)
|
|
||||||
return pkt_err(peer, "Too many HTLCs");
|
return pkt_err(peer, "Too many HTLCs");
|
||||||
|
|
||||||
/* BOLT #2:
|
/* BOLT #2:
|
||||||
|
|||||||
@@ -714,14 +714,12 @@ struct htlc *command_htlc_add(struct peer *peer, u64 msatoshis,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: This is wrong: constraint on remote is sufficient. */
|
|
||||||
/* BOLT #2:
|
/* BOLT #2:
|
||||||
*
|
*
|
||||||
* A node MUST NOT add a HTLC if it would result in it
|
* A node MUST NOT add a HTLC if it would result in it
|
||||||
* offering more than 300 HTLCs in either commitment transaction.
|
* offering more than 300 HTLCs in the remote commitment transaction.
|
||||||
*/
|
*/
|
||||||
if (tal_count(peer->local.staging_cstate->side[OURS].htlcs) == 300
|
if (tal_count(peer->remote.staging_cstate->side[OURS].htlcs) == 300) {
|
||||||
|| tal_count(peer->remote.staging_cstate->side[OURS].htlcs) == 300) {
|
|
||||||
log_unusual(peer->log, "add_htlc: fail: already at limit");
|
log_unusual(peer->log, "add_htlc: fail: already at limit");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user