Skip to content

Commit a357376

Browse files
committed
small changes
- change default parameters and explain them better - remove checks on incomming HTLCs
1 parent 6e8d675 commit a357376

File tree

3 files changed

+9
-28
lines changed

3 files changed

+9
-28
lines changed

docs/release-notes/eclair-vnext.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ To configure, edit `eclair.conf`:
3737
```eclair.conf
3838
// We assign reputations to our peers to prioritize payments during congestion.
3939
// The reputation is computed as fees paid divided by what should have been paid if all payments were successful.
40-
eclair.peer-reputation {
40+
eclair.relay.peer-reputation {
4141
// Set this parameter to false to disable the reputation algorithm and simply relay the incoming endorsement
4242
// value, as described by https://github.com/lightning/blips/blob/master/blip-0004.md,
4343
enabled = true

eclair-core/src/main/resources/reference.conf

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,12 +245,14 @@ eclair {
245245
// value, as described by https://github.com/lightning/blips/blob/master/blip-0004.md,
246246
enabled = true
247247
// Reputation decays with the following half life to emphasize recent behavior.
248-
half-life = 7 days
248+
half-life = 15 days
249249
// Payments that stay pending for longer than this get penalized.
250250
max-relay-duration = 12 seconds
251251
// Pending payments are counted as failed, and because they could potentially stay pending for a very long time,
252-
// the following multiplier is applied.
253-
pending-multiplier = 1000 // A pending payment counts as a thousand failed ones.
252+
// the following multiplier is applied. We want it to be as close as possible to the true cost of a worst case
253+
// HTLC (max-cltv-delta / max-relay-duration, around 100000 with default parameters) while still being comparable
254+
// to the number of HTLCs received per peer during twice the half life.
255+
pending-multiplier = 200 // A pending payment counts as two hundred failed ones.
254256
}
255257
}
256258

eclair-core/src/main/scala/fr/acinq/eclair/channel/Commitments.scala

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -565,14 +565,6 @@ case class Commitment(fundingTxIndex: Long,
565565
return Left(TooManyAcceptedHtlcs(params.channelId, maximum = params.localParams.maxAcceptedHtlcs))
566566
}
567567

568-
// Jamming protection
569-
// Must be the last checks so that they can be ignored for shadow deployment.
570-
for ((amountMsat, i) <- incomingHtlcs.toSeq.map(_.amountMsat).sorted.zipWithIndex) {
571-
if ((amountMsat.toLong < 1) || (math.log(amountMsat.toLong.toDouble) * params.localParams.maxAcceptedHtlcs / math.log(params.localParams.maxHtlcValueInFlightMsat.toLong.toDouble / params.localParams.maxAcceptedHtlcs) < i)) {
572-
return Left(TooManySmallHtlcs(params.channelId, number = i + 1, below = amountMsat))
573-
}
574-
}
575-
576568
Right(())
577569
}
578570

@@ -901,7 +893,7 @@ case class Commitments(params: ChannelParams,
901893
.getOrElse(Right(copy(changes = changes1, originChannels = originChannels1), add))
902894
}
903895

904-
def receiveAdd(add: UpdateAddHtlc, feerates: FeeratesPerKw, feeConf: OnChainFeeConf)(implicit log: LoggingAdapter): Either[ChannelException, Commitments] = {
896+
def receiveAdd(add: UpdateAddHtlc, feerates: FeeratesPerKw, feeConf: OnChainFeeConf): Either[ChannelException, Commitments] = {
905897
if (add.id != changes.remoteNextHtlcId) {
906898
return Left(UnexpectedHtlcId(channelId, expected = changes.remoteNextHtlcId, actual = add.id))
907899
}
@@ -914,21 +906,8 @@ case class Commitments(params: ChannelParams,
914906

915907
val changes1 = changes.addRemoteProposal(add).copy(remoteNextHtlcId = changes.remoteNextHtlcId + 1)
916908
// we verify that this htlc is allowed in every active commitment
917-
val canReceiveAdds = active.map(_.canReceiveAdd(add.amountMsat, params, changes1, feerates, feeConf))
918-
// Log only for jamming protection.
919-
canReceiveAdds.collectFirst {
920-
case Left(f: TooManySmallHtlcs) =>
921-
log.info("TooManySmallHtlcs: {} incoming HTLCs are below {}}", f.number, f.below)
922-
Metrics.dropHtlc(f, Tags.Directions.Incoming)
923-
}
924-
canReceiveAdds.flatMap { // TODO: We ignore jamming protection, delete this flatMap to activate jamming protection.
925-
case Left(_: TooManySmallHtlcs) | Left(_: ConfidenceTooLow) => None
926-
case x => Some(x)
927-
}
928-
.collectFirst { case Left(f) =>
929-
Metrics.dropHtlc(f, Tags.Directions.Incoming)
930-
Left(f)
931-
}
909+
active.map(_.canReceiveAdd(add.amountMsat, params, changes1, feerates, feeConf))
910+
.collectFirst { case Left(f) => Left(f) }
932911
.getOrElse(Right(copy(changes = changes1)))
933912
}
934913

0 commit comments

Comments
 (0)