@@ -119,7 +119,7 @@ class MultiPartHandler(nodeParams: NodeParams, register: ActorRef, db: IncomingP
119119 ctx.self ! ProcessPacket (add, payload, Some (IncomingStandardPayment (invoice, paymentPreimage, PaymentType .KeySend , TimestampMilli .now(), IncomingPaymentStatus .Pending )))
120120 case _ =>
121121 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 )
123123 PendingCommandsDb .safeSend(register, nodeParams.db.pendingCommands, add.channelId, cmdFail)
124124 }
125125 }
@@ -145,7 +145,7 @@ class MultiPartHandler(nodeParams: NodeParams, register: ActorRef, db: IncomingP
145145
146146 case RejectPacket (add, failure) if doHandle(add.paymentHash) =>
147147 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 )
149149 PendingCommandsDb .safeSend(register, nodeParams.db.pendingCommands, add.channelId, cmdFail)
150150
151151 case MultiPartPaymentFSM .MultiPartPaymentFailed (paymentHash, failure, parts) if doHandle(paymentHash) =>
@@ -154,7 +154,7 @@ class MultiPartHandler(nodeParams: NodeParams, register: ActorRef, db: IncomingP
154154 log.warning(" payment with paidAmount={} failed ({})" , parts.map(_.amount).sum, failure)
155155 pendingPayments.get(paymentHash).foreach { case (_, handler : ActorRef ) => handler ! PoisonPill }
156156 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 ))
158158 }
159159 pendingPayments = pendingPayments - paymentHash
160160 }
@@ -174,7 +174,7 @@ class MultiPartHandler(nodeParams: NodeParams, register: ActorRef, db: IncomingP
174174 Logs .withMdc(log)(Logs .mdc(paymentHash_opt = Some (paymentHash))) {
175175 failure match {
176176 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 ))
178178 case _ : MultiPartPaymentFSM .RecipientBlindedPathFeePart => ()
179179 }
180180 case None => p match {
@@ -186,7 +186,7 @@ class MultiPartHandler(nodeParams: NodeParams, register: ActorRef, db: IncomingP
186186 PendingCommandsDb .safeSend(register, nodeParams.db.pendingCommands, p.htlc.channelId, CMD_FULFILL_HTLC (p.htlc.id, record.paymentPreimage, commit = true ))
187187 ctx.system.eventStream.publish(received)
188188 } 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 )
190190 PendingCommandsDb .safeSend(register, nodeParams.db.pendingCommands, p.htlc.channelId, cmdFail)
191191 }
192192 })
@@ -221,7 +221,7 @@ class MultiPartHandler(nodeParams: NodeParams, register: ActorRef, db: IncomingP
221221 parts.collect {
222222 case p : MultiPartPaymentFSM .HtlcPart =>
223223 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 )
225225 PendingCommandsDb .safeSend(register, nodeParams.db.pendingCommands, p.htlc.channelId, cmdFail)
226226 }
227227 }
@@ -466,15 +466,15 @@ object MultiPartHandler {
466466
467467 private def validateStandardPayment (nodeParams : NodeParams , add : UpdateAddHtlc , payload : FinalPayload .Standard , record : IncomingStandardPayment )(implicit log : LoggingAdapter ): Option [CMD_FAIL_HTLC ] = {
468468 // 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 )
470470 val commonOk = validateCommon(nodeParams, add, payload, record)
471471 val secretOk = validatePaymentSecret(add, payload, record.invoice)
472472 if (commonOk && secretOk) None else Some (cmdFail)
473473 }
474474
475475 private def validateBlindedPayment (nodeParams : NodeParams , add : UpdateAddHtlc , payload : FinalPayload .Blinded , record : IncomingBlindedPayment , maxRecipientPathFees : MilliSatoshi )(implicit log : LoggingAdapter ): Option [CMD_FAIL_HTLC ] = {
476476 // 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 )
478478 val commonOk = validateCommon(nodeParams, add, payload, record)
479479 // The payer isn't aware of the blinded path fees if we decided to hide them. The HTLC amount will thus be smaller
480480 // than the onion amount, but should match when re-adding the blinded path fees.
0 commit comments