htlcswitch: remove Network type

This commit is contained in:
Elle Mouton
2023-08-03 18:16:03 +02:00
committed by Olaoluwa Osuntokun
parent 77908d6c92
commit 7fa05f92f5
4 changed files with 0 additions and 44 deletions

View File

@@ -10,10 +10,6 @@ import (
// received within the incoming HTLC, to ensure that the prior hop didn't // received within the incoming HTLC, to ensure that the prior hop didn't
// tamper with the end-to-end routing information at all. // tamper with the end-to-end routing information at all.
type ForwardingInfo struct { type ForwardingInfo struct {
// Network is the target blockchain network that the HTLC will travel
// over next.
Network Network
// NextHop is the channel ID of the next hop. The received HTLC should // NextHop is the channel ID of the next hop. The received HTLC should
// be forwarded to this particular channel in order to continue the // be forwarded to this particular channel in order to continue the
// end-to-end route. // end-to-end route.

View File

@@ -1,28 +0,0 @@
package hop
// Network indicates the blockchain network that is intended to be the next hop
// for a forwarded HTLC. The existence of this field within the ForwardingInfo
// struct enables the ability for HTLC to cross chain-boundaries at will.
type Network uint8
const (
// BitcoinNetwork denotes that an HTLC is to be forwarded along the
// Bitcoin link with the specified short channel ID.
BitcoinNetwork Network = iota
// LitecoinNetwork denotes that an HTLC is to be forwarded along the
// Litecoin link with the specified short channel ID.
LitecoinNetwork
)
// String returns the string representation of the target Network.
func (c Network) String() string {
switch c {
case BitcoinNetwork:
return "Bitcoin"
case LitecoinNetwork:
return "Litecoin"
default:
return "Kekcoin"
}
}

View File

@@ -106,7 +106,6 @@ func NewLegacyPayload(f *sphinx.HopData) *Payload {
return &Payload{ return &Payload{
FwdInfo: ForwardingInfo{ FwdInfo: ForwardingInfo{
Network: BitcoinNetwork,
NextHop: lnwire.NewShortChanIDFromInt(nextHop), NextHop: lnwire.NewShortChanIDFromInt(nextHop),
AmountToForward: lnwire.MilliSatoshi(f.ForwardAmount), AmountToForward: lnwire.MilliSatoshi(f.ForwardAmount),
OutgoingCTLV: f.OutgoingCltv, OutgoingCTLV: f.OutgoingCltv,
@@ -187,7 +186,6 @@ func NewPayloadFromReader(r io.Reader) (*Payload, error) {
return &Payload{ return &Payload{
FwdInfo: ForwardingInfo{ FwdInfo: ForwardingInfo{
Network: BitcoinNetwork,
NextHop: nextHop, NextHop: nextHop,
AmountToForward: lnwire.MilliSatoshi(amt), AmountToForward: lnwire.MilliSatoshi(amt),
OutgoingCTLV: cltv, OutgoingCTLV: cltv,

View File

@@ -365,10 +365,6 @@ func (r *mockHopIterator) EncodeNextHop(w io.Writer) error {
} }
func encodeFwdInfo(w io.Writer, f *hop.ForwardingInfo) error { func encodeFwdInfo(w io.Writer, f *hop.ForwardingInfo) error {
if _, err := w.Write([]byte{byte(f.Network)}); err != nil {
return err
}
if err := binary.Write(w, binary.BigEndian, f.NextHop); err != nil { if err := binary.Write(w, binary.BigEndian, f.NextHop); err != nil {
return err return err
} }
@@ -563,12 +559,6 @@ func (p *mockIteratorDecoder) DecodeHopIterators(id []byte,
} }
func decodeFwdInfo(r io.Reader, f *hop.ForwardingInfo) error { func decodeFwdInfo(r io.Reader, f *hop.ForwardingInfo) error {
var net [1]byte
if _, err := r.Read(net[:]); err != nil {
return err
}
f.Network = hop.Network(net[0])
if err := binary.Read(r, binary.BigEndian, &f.NextHop); err != nil { if err := binary.Read(r, binary.BigEndian, &f.NextHop); err != nil {
return err return err
} }