htlcswitch: encapsulate exposed packet info

This commit is contained in:
Joost Jager
2020-06-23 16:19:41 +02:00
parent 607927634d
commit 74db43282c
3 changed files with 33 additions and 18 deletions

View File

@@ -115,15 +115,15 @@ type interceptedForward struct {
}
// Packet returns the intercepted htlc packet.
func (f *interceptedForward) Packet() lnwire.UpdateAddHTLC {
return *f.htlc
}
// CircuitKey returns the circuit key for the intercepted htlc.
func (f *interceptedForward) CircuitKey() channeldb.CircuitKey {
return channeldb.CircuitKey{
ChanID: f.packet.incomingChanID,
HtlcID: f.packet.incomingHTLCID,
func (f *interceptedForward) Packet() InterceptedPacket {
return InterceptedPacket{
IncomingCircuit: channeldb.CircuitKey{
ChanID: f.packet.incomingChanID,
HtlcID: f.packet.incomingHTLCID,
},
Hash: f.htlc.PaymentHash,
OutgoingExpiry: f.htlc.Expiry,
OutgoingAmount: f.htlc.Amount,
}
}