Skip to content

Commit bfdb39e

Browse files
committed
Default to legacy
1 parent 363c167 commit bfdb39e

File tree

4 files changed

+17
-20
lines changed

4 files changed

+17
-20
lines changed

eclair-core/src/main/scala/fr/acinq/eclair/channel/fsm/Channel.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -640,8 +640,8 @@ class Channel(val nodeParams: NodeParams, val wallet: OnChainChannelFunder with
640640
case PostRevocationAction.RejectHtlc(add) =>
641641
log.debug("rejecting incoming htlc {}", add)
642642
// NB: we don't set commit = true, we will sign all updates at once afterwards.
643-
// The HTLC is rejected without reading the onion, we default to using attributable errors if the feature is activated.
644-
self ! CMD_FAIL_HTLC(add.id, Right(TemporaryChannelFailure(d.channelUpdate)), useAttributableErrors = nodeParams.features.hasFeature(Features.AttributableError), TimestampMilli.now(), commit = true)
643+
// The HTLC is rejected without reading the onion, we default to legacy errors.
644+
self ! CMD_FAIL_HTLC(add.id, Right(TemporaryChannelFailure(d.channelUpdate)), useAttributableErrors = false, TimestampMilli.now(), commit = true)
645645
case PostRevocationAction.RelayFailure(result) =>
646646
log.debug("forwarding {} to relayer", result)
647647
relayer ! result
@@ -1342,13 +1342,13 @@ class Channel(val nodeParams: NodeParams, val wallet: OnChainChannelFunder with
13421342
case PostRevocationAction.RelayHtlc(add) =>
13431343
// BOLT 2: A sending node SHOULD fail to route any HTLC added after it sent shutdown.
13441344
log.debug("closing in progress: failing {}", add)
1345-
// The HTLC is rejected without reading the onion, we default to using attributable errors if the feature is activated.
1346-
self ! CMD_FAIL_HTLC(add.id, Right(PermanentChannelFailure()), useAttributableErrors = nodeParams.features.hasFeature(Features.AttributableError), TimestampMilli.now(), commit = true)
1345+
// The HTLC is rejected without reading the onion, we default to legacy errors.
1346+
self ! CMD_FAIL_HTLC(add.id, Right(PermanentChannelFailure()), useAttributableErrors = false, TimestampMilli.now(), commit = true)
13471347
case PostRevocationAction.RejectHtlc(add) =>
13481348
// BOLT 2: A sending node SHOULD fail to route any HTLC added after it sent shutdown.
13491349
log.debug("closing in progress: rejecting {}", add)
1350-
// The HTLC is rejected without reading the onion, we default to using attributable errors if the feature is activated.
1351-
self ! CMD_FAIL_HTLC(add.id, Right(PermanentChannelFailure()), useAttributableErrors = nodeParams.features.hasFeature(Features.AttributableError), TimestampMilli.now(), commit = true)
1350+
// The HTLC is rejected without reading the onion, we default to legacy errors.
1351+
self ! CMD_FAIL_HTLC(add.id, Right(PermanentChannelFailure()), useAttributableErrors = false, TimestampMilli.now(), commit = true)
13521352
case PostRevocationAction.RelayFailure(result) =>
13531353
log.debug("forwarding {} to relayer", result)
13541354
relayer ! result

eclair-core/src/main/scala/fr/acinq/eclair/payment/relay/PostRestartHtlcCleaner.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ class PostRestartHtlcCleaner(nodeParams: NodeParams, register: ActorRef, initial
131131
val failure = InvalidOnionBlinding(ByteVector32.Zeroes)
132132
CMD_FAIL_MALFORMED_HTLC(htlc.id, failure.onionHash, failure.code, commit = true)
133133
case None =>
134-
// By default we use attributable errors if the feature is activated.
135-
CMD_FAIL_HTLC(htlc.id, Right(TemporaryNodeFailure()), useAttributableErrors = nodeParams.features.hasFeature(Features.AttributableError), TimestampMilli.min, commit = true)
134+
// By default we use legacy errors.
135+
CMD_FAIL_HTLC(htlc.id, Right(TemporaryNodeFailure()), useAttributableErrors = false, TimestampMilli.min, commit = true)
136136
}
137137
channel ! cmd
138138
} else {
@@ -262,8 +262,8 @@ class PostRestartHtlcCleaner(nodeParams: NodeParams, register: ActorRef, initial
262262
val failure = InvalidOnionBlinding(ByteVector32.Zeroes)
263263
CMD_FAIL_MALFORMED_HTLC(originHtlcId, failure.onionHash, failure.code, commit = true)
264264
case None =>
265-
// By default we use attributable errors if the feature is activated.
266-
ChannelRelay.translateRelayFailure(originHtlcId, fail, useAttributableErrors = nodeParams.features.hasFeature(Features.AttributableError), TimestampMilli.min)
265+
// By default we use legacy errors.
266+
ChannelRelay.translateRelayFailure(originHtlcId, fail, useAttributableErrors = false, TimestampMilli.min)
267267
}
268268
PendingCommandsDb.safeSend(register, nodeParams.db.pendingCommands, originChannelId, cmd)
269269
case Origin.TrampolineRelayedCold(origins) =>
@@ -272,8 +272,8 @@ class PostRestartHtlcCleaner(nodeParams: NodeParams, register: ActorRef, initial
272272
Metrics.Resolved.withTag(Tags.Success, value = false).withTag(Metrics.Relayed, value = true).increment()
273273
// We don't bother decrypting the downstream failure to forward a more meaningful error upstream, it's
274274
// very likely that it won't be actionable anyway because of our node restart.
275-
// By default we use attributable errors if the feature is activated.
276-
PendingCommandsDb.safeSend(register, nodeParams.db.pendingCommands, channelId, CMD_FAIL_HTLC(htlcId, Right(TemporaryNodeFailure()), useAttributableErrors = nodeParams.features.hasFeature(Features.AttributableError), TimestampMilli.min, commit = true))
275+
// By default we use legacy errors.
276+
PendingCommandsDb.safeSend(register, nodeParams.db.pendingCommands, channelId, CMD_FAIL_HTLC(htlcId, Right(TemporaryNodeFailure()), useAttributableErrors = false, TimestampMilli.min, commit = true))
277277
}
278278
}
279279
}

eclair-core/src/main/scala/fr/acinq/eclair/payment/relay/Relayer.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,17 +84,17 @@ class Relayer(nodeParams: NodeParams, router: ActorRef, register: ActorRef, paym
8484
// We are the introduction point of a blinded path: we add a non-negligible delay to make it look like it
8585
// could come from a downstream node.
8686
val delay = Some(500.millis + Random.nextLong(1500).millis)
87-
// By default we use attributable errors if the feature is activated.
88-
CMD_FAIL_HTLC(add.id, Right(InvalidOnionBlinding(badOnion.onionHash)), useAttributableErrors = nodeParams.features.hasFeature(Features.AttributableError), TimestampMilli.now(), delay, commit = true)
87+
// By default we use legacy errors.
88+
CMD_FAIL_HTLC(add.id, Right(InvalidOnionBlinding(badOnion.onionHash)), useAttributableErrors = false, TimestampMilli.now(), delay, commit = true)
8989
case _ =>
9090
CMD_FAIL_MALFORMED_HTLC(add.id, badOnion.onionHash, badOnion.code, commit = true)
9191
}
9292
log.warning(s"rejecting htlc #${add.id} from channelId=${add.channelId} reason=malformed onionHash=${badOnion.onionHash} failureCode=${badOnion.code}")
9393
PendingCommandsDb.safeSend(register, nodeParams.db.pendingCommands, add.channelId, cmdFail)
9494
case Left(failure) =>
9595
log.warning(s"rejecting htlc #${add.id} from channelId=${add.channelId} reason=$failure")
96-
// By default we use attributable errors if the feature is activated.
97-
val cmdFail = CMD_FAIL_HTLC(add.id, Right(failure), useAttributableErrors = nodeParams.features.hasFeature(Features.AttributableError), TimestampMilli.now(), commit = true)
96+
// By default we use legacy errors.
97+
val cmdFail = CMD_FAIL_HTLC(add.id, Right(failure), useAttributableErrors = false, TimestampMilli.now(), commit = true)
9898
PendingCommandsDb.safeSend(register, nodeParams.db.pendingCommands, add.channelId, cmdFail)
9999
}
100100

eclair-core/src/test/scala/fr/acinq/eclair/integration/basic/payment/OfferPaymentSpec.scala

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import com.softwaremill.quicklens.ModifyPimp
2424
import fr.acinq.bitcoin.scalacompat.Crypto.PublicKey
2525
import fr.acinq.bitcoin.scalacompat.{ByteVector32, SatoshiLong}
2626
import fr.acinq.eclair.FeatureSupport.Optional
27-
import fr.acinq.eclair.Features.{AttributableError, KeySend, RouteBlinding}
27+
import fr.acinq.eclair.Features.{KeySend, RouteBlinding}
2828
import fr.acinq.eclair.channel.{DATA_NORMAL, RealScidStatus}
2929
import fr.acinq.eclair.integration.basic.fixtures.MinimalNodeFixture
3030
import fr.acinq.eclair.integration.basic.fixtures.MinimalNodeFixture.{connect, getChannelData, getPeerChannels, getRouterData, knownFundingTxs, nodeParamsFor, openChannel, watcherAutopilot}
@@ -61,19 +61,16 @@ class OfferPaymentSpec extends FixtureSpec with IntegrationPatience {
6161
val aliceParams = nodeParamsFor("alice", ByteVector32(hex"b4acd47335b25ab7b84b8c020997b12018592bb4631b868762154d77fa8b93a3"))
6262
.modify(_.onionMessageConfig.timeout).setTo(5 minutes)
6363
.modify(_.features.activated).using(_ + (RouteBlinding -> Optional))
64-
.modify(_.features.activated).using(_ - AttributableError)
6564
.modify(_.channelConf.channelFlags.announceChannel).setTo(!testData.tags.contains(PrivateChannels))
6665
val bobParams = nodeParamsFor("bob", ByteVector32(hex"7620226fec887b0b2ebe76492e5a3fd3eb0e47cd3773263f6a81b59a704dc492"))
6766
.modify(_.onionMessageConfig.timeout).setTo(5 minutes)
6867
.modify(_.features.activated).using(_ + (RouteBlinding -> Optional))
69-
.modify(_.features.activated).using(_ - AttributableError)
7068
.modify(_.features.activated).usingIf(testData.tags.contains(RouteBlindingDisabledBob))(_ - RouteBlinding)
7169
.modify(_.channelConf.channelFlags.announceChannel).setTo(!testData.tags.contains(PrivateChannels))
7270
val carolParams = nodeParamsFor("carol", ByteVector32(hex"ebd5a5d3abfb3ef73731eb3418d918f247445183180522674666db98a66411cc"))
7371
.modify(_.onionMessageConfig.timeout).setTo(5 minutes)
7472
.modify(_.features.activated).using(_ + (RouteBlinding -> Optional))
7573
.modify(_.features.activated).using(_ + (KeySend -> Optional))
76-
.modify(_.features.activated).using(_ - AttributableError)
7774
.modify(_.features.activated).usingIf(testData.tags.contains(RouteBlindingDisabledCarol))(_ - RouteBlinding)
7875
.modify(_.channelConf.channelFlags.announceChannel).setTo(!testData.tags.contains(PrivateChannels))
7976

0 commit comments

Comments
 (0)