@@ -119,7 +119,7 @@ class MultiPartHandler(nodeParams: NodeParams, register: ActorRef, db: IncomingP
119
119
ctx.self ! ProcessPacket (add, payload, Some (IncomingStandardPayment (invoice, paymentPreimage, PaymentType .KeySend , TimestampMilli .now(), IncomingPaymentStatus .Pending )))
120
120
case _ =>
121
121
Metrics .PaymentFailed .withTag(Tags .Direction , Tags .Directions .Received ).withTag(Tags .Failure , " InvoiceNotFound" ).increment()
122
- val cmdFail = CMD_FAIL_HTLC (add.id, FailureReason .LocalFailure (IncorrectOrUnknownPaymentDetails (payload.totalAmount, nodeParams.currentBlockHeight)), TimestampMilli .now(), commit = true )
122
+ val cmdFail = CMD_FAIL_HTLC (add.id, FailureReason .LocalFailure (IncorrectOrUnknownPaymentDetails (payload.totalAmount, nodeParams.currentBlockHeight)), Some ( TimestampMilli .now() ), commit = true )
123
123
PendingCommandsDb .safeSend(register, nodeParams.db.pendingCommands, add.channelId, cmdFail)
124
124
}
125
125
}
@@ -145,7 +145,7 @@ class MultiPartHandler(nodeParams: NodeParams, register: ActorRef, db: IncomingP
145
145
146
146
case RejectPacket (add, failure) if doHandle(add.paymentHash) =>
147
147
Metrics .PaymentFailed .withTag(Tags .Direction , Tags .Directions .Received ).withTag(Tags .Failure , failure.getClass.getSimpleName).increment()
148
- val cmdFail = CMD_FAIL_HTLC (add.id, FailureReason .LocalFailure (failure), TimestampMilli .now(), commit = true )
148
+ val cmdFail = CMD_FAIL_HTLC (add.id, FailureReason .LocalFailure (failure), Some ( TimestampMilli .now() ), commit = true )
149
149
PendingCommandsDb .safeSend(register, nodeParams.db.pendingCommands, add.channelId, cmdFail)
150
150
151
151
case MultiPartPaymentFSM .MultiPartPaymentFailed (paymentHash, failure, parts) if doHandle(paymentHash) =>
@@ -154,7 +154,7 @@ class MultiPartHandler(nodeParams: NodeParams, register: ActorRef, db: IncomingP
154
154
log.warning(" payment with paidAmount={} failed ({})" , parts.map(_.amount).sum, failure)
155
155
pendingPayments.get(paymentHash).foreach { case (_, handler : ActorRef ) => handler ! PoisonPill }
156
156
parts.collect {
157
- case p : MultiPartPaymentFSM .HtlcPart => PendingCommandsDb .safeSend(register, nodeParams.db.pendingCommands, p.htlc.channelId, CMD_FAIL_HTLC (p.htlc.id, FailureReason .LocalFailure (failure), p.startTime , commit = true ))
157
+ case p : MultiPartPaymentFSM .HtlcPart => PendingCommandsDb .safeSend(register, nodeParams.db.pendingCommands, p.htlc.channelId, CMD_FAIL_HTLC (p.htlc.id, FailureReason .LocalFailure (failure), Some (p.receivedAt) , commit = true ))
158
158
}
159
159
pendingPayments = pendingPayments - paymentHash
160
160
}
@@ -174,7 +174,7 @@ class MultiPartHandler(nodeParams: NodeParams, register: ActorRef, db: IncomingP
174
174
Logs .withMdc(log)(Logs .mdc(paymentHash_opt = Some (paymentHash))) {
175
175
failure match {
176
176
case Some (failure) => p match {
177
- case p : MultiPartPaymentFSM .HtlcPart => PendingCommandsDb .safeSend(register, nodeParams.db.pendingCommands, p.htlc.channelId, CMD_FAIL_HTLC (p.htlc.id, FailureReason .LocalFailure (failure), p.startTime , commit = true ))
177
+ case p : MultiPartPaymentFSM .HtlcPart => PendingCommandsDb .safeSend(register, nodeParams.db.pendingCommands, p.htlc.channelId, CMD_FAIL_HTLC (p.htlc.id, FailureReason .LocalFailure (failure), Some (p.receivedAt) , commit = true ))
178
178
case _ : MultiPartPaymentFSM .RecipientBlindedPathFeePart => ()
179
179
}
180
180
case None => p match {
@@ -186,7 +186,7 @@ class MultiPartHandler(nodeParams: NodeParams, register: ActorRef, db: IncomingP
186
186
PendingCommandsDb .safeSend(register, nodeParams.db.pendingCommands, p.htlc.channelId, CMD_FULFILL_HTLC (p.htlc.id, record.paymentPreimage, commit = true ))
187
187
ctx.system.eventStream.publish(received)
188
188
} else {
189
- val cmdFail = CMD_FAIL_HTLC (p.htlc.id, FailureReason .LocalFailure (IncorrectOrUnknownPaymentDetails (received.amount, nodeParams.currentBlockHeight)), p.startTime , commit = true )
189
+ val cmdFail = CMD_FAIL_HTLC (p.htlc.id, FailureReason .LocalFailure (IncorrectOrUnknownPaymentDetails (received.amount, nodeParams.currentBlockHeight)), Some (p.receivedAt) , commit = true )
190
190
PendingCommandsDb .safeSend(register, nodeParams.db.pendingCommands, p.htlc.channelId, cmdFail)
191
191
}
192
192
})
@@ -221,7 +221,7 @@ class MultiPartHandler(nodeParams: NodeParams, register: ActorRef, db: IncomingP
221
221
parts.collect {
222
222
case p : MultiPartPaymentFSM .HtlcPart =>
223
223
Metrics .PaymentFailed .withTag(Tags .Direction , Tags .Directions .Received ).withTag(Tags .Failure , " InvoiceNotFound" ).increment()
224
- val cmdFail = CMD_FAIL_HTLC (p.htlc.id, FailureReason .LocalFailure (IncorrectOrUnknownPaymentDetails (received.amount, nodeParams.currentBlockHeight)), p.startTime , commit = true )
224
+ val cmdFail = CMD_FAIL_HTLC (p.htlc.id, FailureReason .LocalFailure (IncorrectOrUnknownPaymentDetails (received.amount, nodeParams.currentBlockHeight)), Some (p.receivedAt) , commit = true )
225
225
PendingCommandsDb .safeSend(register, nodeParams.db.pendingCommands, p.htlc.channelId, cmdFail)
226
226
}
227
227
}
@@ -466,15 +466,15 @@ object MultiPartHandler {
466
466
467
467
private def validateStandardPayment (nodeParams : NodeParams , add : UpdateAddHtlc , payload : FinalPayload .Standard , record : IncomingStandardPayment )(implicit log : LoggingAdapter ): Option [CMD_FAIL_HTLC ] = {
468
468
// We send the same error regardless of the failure to avoid probing attacks.
469
- val cmdFail = CMD_FAIL_HTLC (add.id, FailureReason .LocalFailure (IncorrectOrUnknownPaymentDetails (payload.totalAmount, nodeParams.currentBlockHeight)), TimestampMilli .now(), commit = true )
469
+ val cmdFail = CMD_FAIL_HTLC (add.id, FailureReason .LocalFailure (IncorrectOrUnknownPaymentDetails (payload.totalAmount, nodeParams.currentBlockHeight)), Some ( TimestampMilli .now() ), commit = true )
470
470
val commonOk = validateCommon(nodeParams, add, payload, record)
471
471
val secretOk = validatePaymentSecret(add, payload, record.invoice)
472
472
if (commonOk && secretOk) None else Some (cmdFail)
473
473
}
474
474
475
475
private def validateBlindedPayment (nodeParams : NodeParams , add : UpdateAddHtlc , payload : FinalPayload .Blinded , record : IncomingBlindedPayment , maxRecipientPathFees : MilliSatoshi )(implicit log : LoggingAdapter ): Option [CMD_FAIL_HTLC ] = {
476
476
// We send the same error regardless of the failure to avoid probing attacks.
477
- val cmdFail = CMD_FAIL_HTLC (add.id, FailureReason .LocalFailure (IncorrectOrUnknownPaymentDetails (payload.totalAmount, nodeParams.currentBlockHeight)), TimestampMilli .now(), commit = true )
477
+ val cmdFail = CMD_FAIL_HTLC (add.id, FailureReason .LocalFailure (IncorrectOrUnknownPaymentDetails (payload.totalAmount, nodeParams.currentBlockHeight)), Some ( TimestampMilli .now() ), commit = true )
478
478
val commonOk = validateCommon(nodeParams, add, payload, record)
479
479
// The payer isn't aware of the blinded path fees if we decided to hide them. The HTLC amount will thus be smaller
480
480
// than the onion amount, but should match when re-adding the blinded path fees.
0 commit comments