Skip to content

Commit 2a8b5b0

Browse files
committed
remove superfluous signature optimization
When replaying parts that were waiting for an on-the-fly funding, we explicitly set `commit = false` to all parts but the last one, in order to save us from signing multiple times. But this has side effects in the case where the last part is rejected for some reason, because previous parts stay stuck waiting for a `CMD_SIGN` that never arrives.
1 parent 0e04e72 commit 2a8b5b0

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,7 @@ object OnTheFlyFunding {
292292
// This lets us detect that this HTLC is an on-the-fly funded HTLC.
293293
val htlcFees = LiquidityAds.FundingFee(remainingFees.min(p.maxFees(htlcMinimum)), cmd.status.txId)
294294
val origin = Origin.Hot(htlcSettledAdapter.toClassic, p.upstream)
295-
// We only sign at the end of the whole batch.
296-
val commit = p.htlc.id == cmd.proposed.last.htlc.id
297-
val add = CMD_ADD_HTLC(cmdAdapter.toClassic, p.htlc.amount - htlcFees.amount, paymentHash, p.htlc.expiry, p.htlc.finalPacket, p.htlc.blinding_opt, 1.0, Some(htlcFees), origin, commit)
295+
val add = CMD_ADD_HTLC(cmdAdapter.toClassic, p.htlc.amount - htlcFees.amount, paymentHash, p.htlc.expiry, p.htlc.finalPacket, p.htlc.blinding_opt, 1.0, Some(htlcFees), origin, commit = true)
298296
cmd.channel ! add
299297
remainingFees - htlcFees.amount
300298
}

eclair-core/src/test/scala/fr/acinq/eclair/payment/relay/OnTheFlyFundingSpec.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -867,8 +867,7 @@ class OnTheFlyFundingSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike {
867867
assert(add.fundingFee_opt.nonEmpty)
868868
assert(add.fundingFee_opt.get.fundingTxId == purchase.txId)
869869
})
870-
adds1.take(1).foreach(add => assert(!add.commit))
871-
assert(adds1.last.commit)
870+
adds1.foreach(add => assert(add.commit))
872871
assert(adds1.map(_.fundingFee_opt.get.amount).sum == fees.total.toMilliSatoshi)
873872
assert(adds1.map(add => add.amount + add.fundingFee_opt.get.amount).sum == 110_000_000.msat)
874873
channel.expectNoMessage(100 millis)

0 commit comments

Comments
 (0)