mirror of
https://github.com/ACINQ/eclair.git
synced 2025-03-12 10:30:45 +01:00
small changes
- change default parameters and explain them better - remove checks on incomming HTLCs
This commit is contained in:
parent
6e8d67550c
commit
a3573765d3
3 changed files with 9 additions and 28 deletions
|
@ -37,7 +37,7 @@ To configure, edit `eclair.conf`:
|
|||
```eclair.conf
|
||||
// We assign reputations to our peers to prioritize payments during congestion.
|
||||
// The reputation is computed as fees paid divided by what should have been paid if all payments were successful.
|
||||
eclair.peer-reputation {
|
||||
eclair.relay.peer-reputation {
|
||||
// Set this parameter to false to disable the reputation algorithm and simply relay the incoming endorsement
|
||||
// value, as described by https://github.com/lightning/blips/blob/master/blip-0004.md,
|
||||
enabled = true
|
||||
|
|
|
@ -245,12 +245,14 @@ eclair {
|
|||
// value, as described by https://github.com/lightning/blips/blob/master/blip-0004.md,
|
||||
enabled = true
|
||||
// Reputation decays with the following half life to emphasize recent behavior.
|
||||
half-life = 7 days
|
||||
half-life = 15 days
|
||||
// Payments that stay pending for longer than this get penalized.
|
||||
max-relay-duration = 12 seconds
|
||||
// Pending payments are counted as failed, and because they could potentially stay pending for a very long time,
|
||||
// the following multiplier is applied.
|
||||
pending-multiplier = 1000 // A pending payment counts as a thousand failed ones.
|
||||
// the following multiplier is applied. We want it to be as close as possible to the true cost of a worst case
|
||||
// HTLC (max-cltv-delta / max-relay-duration, around 100000 with default parameters) while still being comparable
|
||||
// to the number of HTLCs received per peer during twice the half life.
|
||||
pending-multiplier = 200 // A pending payment counts as two hundred failed ones.
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -565,14 +565,6 @@ case class Commitment(fundingTxIndex: Long,
|
|||
return Left(TooManyAcceptedHtlcs(params.channelId, maximum = params.localParams.maxAcceptedHtlcs))
|
||||
}
|
||||
|
||||
// Jamming protection
|
||||
// Must be the last checks so that they can be ignored for shadow deployment.
|
||||
for ((amountMsat, i) <- incomingHtlcs.toSeq.map(_.amountMsat).sorted.zipWithIndex) {
|
||||
if ((amountMsat.toLong < 1) || (math.log(amountMsat.toLong.toDouble) * params.localParams.maxAcceptedHtlcs / math.log(params.localParams.maxHtlcValueInFlightMsat.toLong.toDouble / params.localParams.maxAcceptedHtlcs) < i)) {
|
||||
return Left(TooManySmallHtlcs(params.channelId, number = i + 1, below = amountMsat))
|
||||
}
|
||||
}
|
||||
|
||||
Right(())
|
||||
}
|
||||
|
||||
|
@ -901,7 +893,7 @@ case class Commitments(params: ChannelParams,
|
|||
.getOrElse(Right(copy(changes = changes1, originChannels = originChannels1), add))
|
||||
}
|
||||
|
||||
def receiveAdd(add: UpdateAddHtlc, feerates: FeeratesPerKw, feeConf: OnChainFeeConf)(implicit log: LoggingAdapter): Either[ChannelException, Commitments] = {
|
||||
def receiveAdd(add: UpdateAddHtlc, feerates: FeeratesPerKw, feeConf: OnChainFeeConf): Either[ChannelException, Commitments] = {
|
||||
if (add.id != changes.remoteNextHtlcId) {
|
||||
return Left(UnexpectedHtlcId(channelId, expected = changes.remoteNextHtlcId, actual = add.id))
|
||||
}
|
||||
|
@ -914,21 +906,8 @@ case class Commitments(params: ChannelParams,
|
|||
|
||||
val changes1 = changes.addRemoteProposal(add).copy(remoteNextHtlcId = changes.remoteNextHtlcId + 1)
|
||||
// we verify that this htlc is allowed in every active commitment
|
||||
val canReceiveAdds = active.map(_.canReceiveAdd(add.amountMsat, params, changes1, feerates, feeConf))
|
||||
// Log only for jamming protection.
|
||||
canReceiveAdds.collectFirst {
|
||||
case Left(f: TooManySmallHtlcs) =>
|
||||
log.info("TooManySmallHtlcs: {} incoming HTLCs are below {}}", f.number, f.below)
|
||||
Metrics.dropHtlc(f, Tags.Directions.Incoming)
|
||||
}
|
||||
canReceiveAdds.flatMap { // TODO: We ignore jamming protection, delete this flatMap to activate jamming protection.
|
||||
case Left(_: TooManySmallHtlcs) | Left(_: ConfidenceTooLow) => None
|
||||
case x => Some(x)
|
||||
}
|
||||
.collectFirst { case Left(f) =>
|
||||
Metrics.dropHtlc(f, Tags.Directions.Incoming)
|
||||
Left(f)
|
||||
}
|
||||
active.map(_.canReceiveAdd(add.amountMsat, params, changes1, feerates, feeConf))
|
||||
.collectFirst { case Left(f) => Left(f) }
|
||||
.getOrElse(Right(copy(changes = changes1)))
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue