@@ -606,11 +606,17 @@ func WithTLVPayloadOnly() ProcessOnionOpt {
606606// in the onion packet to derive the shared secret. Finally, if the MAC doesn't
607607// check the packet is again rejected.
608608//
609- // In the case of a successful packet processing, and ProcessedPacket struct is
609+ // The replayData parameter is passed to the ReplayLog and can be used by
610+ // implementations to store auxiliary data alongside the packet hash. For
611+ // example, in HTLC forwarding this could be the incoming CLTV value. When using
612+ // NoOpReplayLog (no replay protection), this value is ignored and can be set
613+ // to 0.
614+ //
615+ // In the case of a successful packet processing, a ProcessedPacket struct is
610616// returned which houses the newly parsed packet, along with instructions on
611617// what to do next.
612618func (r * Router ) ProcessOnionPacket (onionPkt * OnionPacket , assocData []byte ,
613- incomingCltv uint32 , opts ... ProcessOnionOpt ) (* ProcessedPacket ,
619+ replayData uint32 , opts ... ProcessOnionOpt ) (* ProcessedPacket ,
614620 error ) {
615621
616622 cfg := & processOnionCfg {}
@@ -642,7 +648,7 @@ func (r *Router) ProcessOnionPacket(onionPkt *OnionPacket, assocData []byte,
642648
643649 // Atomically compare this hash prefix with the contents of the on-disk
644650 // log, persisting it only if this entry was not detected as a replay.
645- if err := r .log .Put (hashPrefix , incomingCltv ); err != nil {
651+ if err := r .log .Put (hashPrefix , replayData ); err != nil {
646652 return nil , err
647653 }
648654
@@ -853,11 +859,17 @@ func (r *Router) BeginTxn(id []byte, nels int) *Tx {
853859// in the onion packet to derive the shared secret. Finally, if the MAC doesn't
854860// check the packet is again rejected.
855861//
856- // In the case of a successful packet processing, and ProcessedPacket struct is
862+ // The replayData parameter is passed to the ReplayLog and can be used by
863+ // implementations to store auxiliary data alongside the packet hash. For
864+ // example, in HTLC forwarding this could be the incoming CLTV value. When using
865+ // NoOpReplayLog (no replay protection), this value is ignored and can be set
866+ // to 0.
867+ //
868+ // In the case of a successful packet processing, a ProcessedPacket struct is
857869// returned which houses the newly parsed packet, along with instructions on
858870// what to do next.
859871func (t * Tx ) ProcessOnionPacket (seqNum uint16 , onionPkt * OnionPacket ,
860- assocData []byte , incomingCltv uint32 , opts ... ProcessOnionOpt ) error {
872+ assocData []byte , replayData uint32 , opts ... ProcessOnionOpt ) error {
861873
862874 cfg := & processOnionCfg {}
863875 for _ , o := range opts {
@@ -891,7 +903,7 @@ func (t *Tx) ProcessOnionPacket(seqNum uint16, onionPkt *OnionPacket,
891903
892904 // Add the hash prefix to pending batch of shared secrets that will be
893905 // written later via Commit().
894- err = t .batch .Put (seqNum , hashPrefix , incomingCltv )
906+ err = t .batch .Put (seqNum , hashPrefix , replayData )
895907 if err != nil {
896908 return err
897909 }
0 commit comments