github.com/decred/dcrlnd@v0.7.6/zpay32/hophint.go (about)

     1  package zpay32
     2  
     3  import "github.com/decred/dcrd/dcrec/secp256k1/v4"
     4  
     5  const (
     6  	// DefaultAssumedFinalCLTVDelta is the default value to be used as the
     7  	// final CLTV delta for a route if one is unspecified in the payment
     8  	// request.
     9  	DefaultAssumedFinalCLTVDelta = 9
    10  )
    11  
    12  // HopHint is a routing hint that contains the minimum information of a channel
    13  // required for an intermediate hop in a route to forward the payment to the
    14  // next. This should be ideally used for private channels, since they are not
    15  // publicly advertised to the network for routing.
    16  type HopHint struct {
    17  	// NodeID is the public key of the node at the start of the channel.
    18  	NodeID *secp256k1.PublicKey
    19  
    20  	// ChannelID is the unique identifier of the channel.
    21  	ChannelID uint64
    22  
    23  	// FeeBaseMAtoms is the base fee of the channel in millisatoshis.
    24  	FeeBaseMAtoms uint32
    25  
    26  	// FeeProportionalMillionths is the fee rate, in millionths of a
    27  	// satoshi, for every satoshi sent through the channel.
    28  	FeeProportionalMillionths uint32
    29  
    30  	// CLTVExpiryDelta is the time-lock delta of the channel.
    31  	CLTVExpiryDelta uint16
    32  }
    33  
    34  // Copy returns a deep copy of the hop hint.
    35  func (h HopHint) Copy() HopHint {
    36  	nodeID := *h.NodeID
    37  	return HopHint{
    38  		NodeID:                    &nodeID,
    39  		ChannelID:                 h.ChannelID,
    40  		FeeBaseMAtoms:             h.FeeBaseMAtoms,
    41  		FeeProportionalMillionths: h.FeeProportionalMillionths,
    42  		CLTVExpiryDelta:           h.CLTVExpiryDelta,
    43  	}
    44  }