htlcswitch: expose custom records on intercepted packet

This commit is contained in:
Joost Jager committed 2020-06-27 11:00:46 +02:00
1 parent 363142de33
commit 2903505164
9 files changed
+216 -165

No files matched your search

+1
View File
@@ -127,6 +127,7 @@ func (f *interceptedForward) Packet() InterceptedPacket {
OutgoingAmount: f.htlc.Amount,
IncomingAmount: f.packet.incomingAmount,
IncomingExpiry: f.packet.incomingTimeout,
CustomRecords: f.packet.customRecords,
}
}
+5
View File
@@ -8,6 +8,7 @@ import (
"github.com/lightningnetwork/lnd/lntypes"
"github.com/lightningnetwork/lnd/lnwallet"
"github.com/lightningnetwork/lnd/lnwire"
"github.com/lightningnetwork/lnd/record"
)
// InvoiceDatabase is an interface which represents the persistent subsystem
@@ -226,6 +227,10 @@ type InterceptedPacket struct {
// IncomingAmount is the amount of the accepted htlc.
IncomingAmount lnwire.MilliSatoshi
// CustomRecords are user-defined records in the custom type range that
// were included in the payload.
CustomRecords record.CustomSet
}
// InterceptedForward is passed to the ForwardInterceptor for every forwarded
+2
View File
@@ -2731,6 +2731,7 @@ func (l *channelLink) processRemoteAdds(fwdPkg *channeldb.FwdPkg,
obfuscator: obfuscator,
incomingTimeout: pd.Timeout,
outgoingTimeout: fwdInfo.OutgoingCTLV,
customRecords: pld.CustomRecords(),
}
switchPackets = append(
switchPackets, updatePacket,
@@ -2794,6 +2795,7 @@ func (l *channelLink) processRemoteAdds(fwdPkg *channeldb.FwdPkg,
obfuscator: obfuscator,
incomingTimeout: pd.Timeout,
outgoingTimeout: fwdInfo.OutgoingCTLV,
customRecords: pld.CustomRecords(),
}
fwdPkg.FwdFilter.Set(idx)
+5
View File
@@ -4,6 +4,7 @@ import (
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/htlcswitch/hop"
"github.com/lightningnetwork/lnd/lnwire"
"github.com/lightningnetwork/lnd/record"
)
// htlcPacket is a wrapper around htlc lnwire update, which adds additional
@@ -91,6 +92,10 @@ type htlcPacket struct {
// will be extraced from the hop payload recevived by the incoming
// link.
outgoingTimeout uint32
// customRecords are user-defined records in the custom type range that
// were included in the payload.
customRecords record.CustomSet
}
// inKey returns the circuit key used to identify the incoming htlc.