multi: use fwding policy from models pkg

This commit is contained in:
Oliver Gugger 2023-07-17 12:53:24 +02:00 committed by yyforyongyu
parent 59b5fb1565
commit d5c504c8de
No known key found for this signature in database
GPG Key ID: 9BCD95C4FF296868
12 changed files with 52 additions and 105 deletions

View File

@ -25,7 +25,7 @@ import (
"github.com/lightningnetwork/lnd/chainntnfs/btcdnotify"
"github.com/lightningnetwork/lnd/chainntnfs/neutrinonotify"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/htlcswitch"
"github.com/lightningnetwork/lnd/channeldb/models"
"github.com/lightningnetwork/lnd/input"
"github.com/lightningnetwork/lnd/keychain"
"github.com/lightningnetwork/lnd/kvdb"
@ -195,7 +195,7 @@ type PartialChainControl struct {
ChainSource chain.Interface
// RoutingPolicy is the routing policy we have decided to use.
RoutingPolicy htlcswitch.ForwardingPolicy
RoutingPolicy models.ForwardingPolicy
// MinHtlcIn is the minimum HTLC we will accept.
MinHtlcIn lnwire.MilliSatoshi
@ -270,7 +270,7 @@ func NewPartialChainControl(cfg *Config) (*PartialChainControl, func(), error) {
switch cfg.PrimaryChain() {
case BitcoinChain:
cc.RoutingPolicy = htlcswitch.ForwardingPolicy{
cc.RoutingPolicy = models.ForwardingPolicy{
MinHTLCOut: cfg.Bitcoin.MinHTLCOut,
BaseFee: cfg.Bitcoin.BaseFee,
FeeRate: cfg.Bitcoin.FeeRate,
@ -282,7 +282,7 @@ func NewPartialChainControl(cfg *Config) (*PartialChainControl, func(), error) {
DefaultBitcoinStaticMinRelayFeeRate,
)
case LitecoinChain:
cc.RoutingPolicy = htlcswitch.ForwardingPolicy{
cc.RoutingPolicy = models.ForwardingPolicy{
MinHTLCOut: cfg.Litecoin.MinHTLCOut,
BaseFee: cfg.Litecoin.BaseFee,
FeeRate: cfg.Litecoin.FeeRate,

View File

@ -22,7 +22,6 @@ import (
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/channeldb/models"
"github.com/lightningnetwork/lnd/discovery"
"github.com/lightningnetwork/lnd/htlcswitch"
"github.com/lightningnetwork/lnd/input"
"github.com/lightningnetwork/lnd/keychain"
"github.com/lightningnetwork/lnd/labels"
@ -155,7 +154,7 @@ type reservationWithCtx struct {
chanAmt btcutil.Amount
// forwardingPolicy is the policy provided by the initFundingMsg.
forwardingPolicy htlcswitch.ForwardingPolicy
forwardingPolicy models.ForwardingPolicy
// Constraints we require for the remote.
remoteCsvDelay uint16
@ -433,7 +432,7 @@ type Config struct {
// DefaultRoutingPolicy is the default routing policy used when
// initially announcing channels.
DefaultRoutingPolicy htlcswitch.ForwardingPolicy
DefaultRoutingPolicy models.ForwardingPolicy
// DefaultMinHtlcIn is the default minimum incoming htlc value that is
// set as a channel parameter.
@ -520,7 +519,7 @@ type Config struct {
// UpdateForwardingPolicies is used by the manager to update active
// links with a new policy.
UpdateForwardingPolicies func(
chanPolicies map[wire.OutPoint]htlcswitch.ForwardingPolicy)
chanPolicies map[wire.OutPoint]models.ForwardingPolicy)
// OpenChannelPredicate is a predicate on the lnwire.OpenChannel message
// and on the requesting node's public key that returns a bool which
@ -3254,7 +3253,7 @@ func (f *Manager) addToRouterGraph(completeChan *channeldb.OpenChannel,
// our local policy in the switch to make sure we can forward payments
// with the correct fees. We can't do this when creating the link
// initially as that only takes the static channel parameters.
updatedPolicy := map[wire.OutPoint]htlcswitch.ForwardingPolicy{
updatedPolicy := map[wire.OutPoint]models.ForwardingPolicy{
completeChan.FundingOutpoint: {
MinHTLCOut: ann.chanUpdateAnn.HtlcMinimumMsat,
MaxHTLC: ann.chanUpdateAnn.HtlcMaximumMsat,
@ -4624,9 +4623,9 @@ func copyPubKey(pub *btcec.PublicKey) *btcec.PublicKey {
// defaultForwardingPolicy returns the default forwarding policy based on the
// default routing policy and our local channel constraints.
func (f *Manager) defaultForwardingPolicy(
constraints channeldb.ChannelConstraints) *htlcswitch.ForwardingPolicy {
constraints channeldb.ChannelConstraints) *models.ForwardingPolicy {
return &htlcswitch.ForwardingPolicy{
return &models.ForwardingPolicy{
MinHTLCOut: constraints.MinHTLC,
MaxHTLC: constraints.MaxPendingAmount,
BaseFee: f.cfg.DefaultRoutingPolicy.BaseFee,
@ -4638,16 +4637,10 @@ func (f *Manager) defaultForwardingPolicy(
// saveInitialForwardingPolicy saves the forwarding policy for the provided
// chanPoint in the channelOpeningStateBucket.
func (f *Manager) saveInitialForwardingPolicy(chanID lnwire.ChannelID,
forwardingPolicy *htlcswitch.ForwardingPolicy) error {
forwardingPolicy *models.ForwardingPolicy) error {
return f.cfg.ChannelDB.SaveInitialForwardingPolicy(
chanID, &models.ForwardingPolicy{
MinHTLCOut: forwardingPolicy.MinHTLCOut,
MaxHTLC: forwardingPolicy.MaxHTLC,
BaseFee: forwardingPolicy.BaseFee,
FeeRate: forwardingPolicy.FeeRate,
TimeLockDelta: forwardingPolicy.TimeLockDelta,
},
chanID, forwardingPolicy,
)
}
@ -4655,22 +4648,9 @@ func (f *Manager) saveInitialForwardingPolicy(chanID lnwire.ChannelID,
// channel id from the database which will be applied during the channel
// announcement phase.
func (f *Manager) getInitialForwardingPolicy(
chanID lnwire.ChannelID) (*htlcswitch.ForwardingPolicy, error) {
chanID lnwire.ChannelID) (*models.ForwardingPolicy, error) {
dbPolicy, err := f.cfg.ChannelDB.GetInitialForwardingPolicy(
chanID,
)
if err != nil {
return nil, err
}
return &htlcswitch.ForwardingPolicy{
MinHTLCOut: dbPolicy.MinHTLCOut,
MaxHTLC: dbPolicy.MaxHTLC,
BaseFee: dbPolicy.BaseFee,
FeeRate: dbPolicy.FeeRate,
TimeLockDelta: dbPolicy.TimeLockDelta,
}, nil
return f.cfg.ChannelDB.GetInitialForwardingPolicy(chanID)
}
// deleteInitialForwardingPolicy removes channel fees for this chanID from

View File

@ -22,9 +22,9 @@ import (
"github.com/lightningnetwork/lnd/chainreg"
acpt "github.com/lightningnetwork/lnd/chanacceptor"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/channeldb/models"
"github.com/lightningnetwork/lnd/channelnotifier"
"github.com/lightningnetwork/lnd/discovery"
"github.com/lightningnetwork/lnd/htlcswitch"
"github.com/lightningnetwork/lnd/input"
"github.com/lightningnetwork/lnd/keychain"
"github.com/lightningnetwork/lnd/lncfg"
@ -250,7 +250,7 @@ type testNode struct {
testDir string
shutdownChannel chan struct{}
reportScidChan chan struct{}
updatedPolicies chan map[wire.OutPoint]htlcswitch.ForwardingPolicy
updatedPolicies chan map[wire.OutPoint]models.ForwardingPolicy
localFeatures []lnwire.FeatureBit
remoteFeatures []lnwire.FeatureBit
@ -380,7 +380,7 @@ func createTestFundingManager(t *testing.T, privKey *btcec.PrivateKey,
shutdownChan := make(chan struct{})
reportScidChan := make(chan struct{})
updatedPolicies := make(
chan map[wire.OutPoint]htlcswitch.ForwardingPolicy, 1,
chan map[wire.OutPoint]models.ForwardingPolicy, 1,
)
wc := &mock.WalletController{
@ -477,7 +477,7 @@ func createTestFundingManager(t *testing.T, privKey *btcec.PrivateKey,
return nil, fmt.Errorf("unable to find channel")
},
DefaultRoutingPolicy: htlcswitch.ForwardingPolicy{
DefaultRoutingPolicy: models.ForwardingPolicy{
MinHTLCOut: 5,
BaseFee: 100,
FeeRate: 1000,
@ -540,7 +540,7 @@ func createTestFundingManager(t *testing.T, privKey *btcec.PrivateKey,
},
AliasManager: aliasMgr,
UpdateForwardingPolicies: func(
p map[wire.OutPoint]htlcswitch.ForwardingPolicy) {
p map[wire.OutPoint]models.ForwardingPolicy) {
updatedPolicies <- p
},
@ -633,7 +633,7 @@ func recreateAliceFundingManager(t *testing.T, alice *testNode) {
},
TempChanIDSeed: oldCfg.TempChanIDSeed,
FindChannel: oldCfg.FindChannel,
DefaultRoutingPolicy: htlcswitch.ForwardingPolicy{
DefaultRoutingPolicy: models.ForwardingPolicy{
MinHTLCOut: 5,
BaseFee: 100,
FeeRate: 1000,
@ -1146,7 +1146,7 @@ func assertChannelAnnouncements(t *testing.T, alice, bob *testNode,
// At this point we should also have gotten a policy update that
// was sent to the switch subsystem. Make sure it contains the
// same values.
var policyUpdate htlcswitch.ForwardingPolicy
var policyUpdate models.ForwardingPolicy
select {
case policyUpdateMap := <-node.updatedPolicies:
require.Len(t, policyUpdateMap, 1)
@ -1340,7 +1340,7 @@ func assertInitialFwdingPolicyNotFound(t *testing.T, node *testNode,
t.Helper()
var fwdingPolicy *htlcswitch.ForwardingPolicy
var fwdingPolicy *models.ForwardingPolicy
var err error
for i := 0; i < testPollNumTries; i++ {
// If this is not the first try, sleep before retrying.
@ -3076,7 +3076,7 @@ func TestFundingManagerCustomChannelParameters(t *testing.T) {
// Helper method for checking baseFee and feeRate stored for a
// reservation.
assertFees := func(forwardingPolicy *htlcswitch.ForwardingPolicy,
assertFees := func(forwardingPolicy *models.ForwardingPolicy,
baseFee, feeRate lnwire.MilliSatoshi) error {
if forwardingPolicy.BaseFee != baseFee {

View File

@ -191,7 +191,7 @@ type ChannelLink interface {
// UpdateForwardingPolicy updates the forwarding policy for the target
// ChannelLink. Once updated, the link will use the new forwarding
// policy to govern if it an incoming HTLC should be forwarded or not.
UpdateForwardingPolicy(ForwardingPolicy)
UpdateForwardingPolicy(models.ForwardingPolicy)
// CheckHtlcForward should return a nil error if the passed HTLC details
// satisfy the current forwarding policy fo the target link. Otherwise,

View File

@ -64,44 +64,6 @@ const (
DefaultMaxLinkFeeAllocation float64 = 0.5
)
// ForwardingPolicy describes the set of constraints that a given ChannelLink
// is to adhere to when forwarding HTLC's. For each incoming HTLC, this set of
// constraints will be consulted in order to ensure that adequate fees are
// paid, and our time-lock parameters are respected. In the event that an
// incoming HTLC violates any of these constraints, it is to be _rejected_ with
// the error possibly carrying along a ChannelUpdate message that includes the
// latest policy.
type ForwardingPolicy struct {
// MinHTLC is the smallest HTLC that is to be forwarded.
MinHTLCOut lnwire.MilliSatoshi
// MaxHTLC is the largest HTLC that is to be forwarded.
MaxHTLC lnwire.MilliSatoshi
// BaseFee is the base fee, expressed in milli-satoshi that must be
// paid for each incoming HTLC. This field, combined with FeeRate is
// used to compute the required fee for a given HTLC.
BaseFee lnwire.MilliSatoshi
// FeeRate is the fee rate, expressed in milli-satoshi that must be
// paid for each incoming HTLC. This field combined with BaseFee is
// used to compute the required fee for a given HTLC.
FeeRate lnwire.MilliSatoshi
// TimeLockDelta is the absolute time-lock value, expressed in blocks,
// that will be subtracted from an incoming HTLC's timelock value to
// create the time-lock value for the forwarded outgoing HTLC. The
// following constraint MUST hold for an HTLC to be forwarded:
//
// * incomingHtlc.timeLock - timeLockDelta = fwdInfo.OutgoingCTLV
//
// where fwdInfo is the forwarding information extracted from the
// per-hop payload of the incoming HTLC's onion packet.
TimeLockDelta uint32
// TODO(roasbeef): add fee module inside of switch
}
// ExpectedFee computes the expected fee for a given htlc amount. The value
// returned from this function is to be used as a sanity check when forwarding
// HTLC's to ensure that an incoming HTLC properly adheres to our propagated
@ -109,7 +71,7 @@ type ForwardingPolicy struct {
//
// TODO(roasbeef): also add in current available channel bandwidth, inverse
// func
func ExpectedFee(f ForwardingPolicy,
func ExpectedFee(f models.ForwardingPolicy,
htlcAmt lnwire.MilliSatoshi) lnwire.MilliSatoshi {
return f.BaseFee + (htlcAmt*f.FeeRate)/1000000
@ -123,7 +85,7 @@ type ChannelLinkConfig struct {
// deciding whether to forwarding incoming HTLC's or not. This value
// can be updated with subsequent calls to UpdateForwardingPolicy
// targeted at a given ChannelLink concrete interface implementation.
FwrdingPolicy ForwardingPolicy
FwrdingPolicy models.ForwardingPolicy
// Circuits provides restricted access to the switch's circuit map,
// allowing the link to open and close circuits.
@ -2522,7 +2484,9 @@ func (l *channelLink) AttachMailBox(mailbox MailBox) {
// update all of the link's FwrdingPolicy's values.
//
// NOTE: Part of the ChannelLink interface.
func (l *channelLink) UpdateForwardingPolicy(newPolicy ForwardingPolicy) {
func (l *channelLink) UpdateForwardingPolicy(
newPolicy models.ForwardingPolicy) {
l.Lock()
defer l.Unlock()
@ -2627,7 +2591,7 @@ func (l *channelLink) CheckHtlcTransit(payHash [32]byte,
// canSendHtlc checks whether the given htlc parameters satisfy
// the channel's amount and time lock constraints.
func (l *channelLink) canSendHtlc(policy ForwardingPolicy,
func (l *channelLink) canSendHtlc(policy models.ForwardingPolicy,
payHash [32]byte, amt lnwire.MilliSatoshi, timeout uint32,
heightNow uint32, originalScid lnwire.ShortChannelID) *LinkError {

View File

@ -23,6 +23,7 @@ import (
sphinx "github.com/lightningnetwork/lightning-onion"
"github.com/lightningnetwork/lnd/build"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/channeldb/models"
"github.com/lightningnetwork/lnd/contractcourt"
"github.com/lightningnetwork/lnd/htlcswitch/hodl"
"github.com/lightningnetwork/lnd/htlcswitch/hop"
@ -1925,7 +1926,7 @@ func newSingleLinkTestHarness(t *testing.T, chanAmt, chanReserve btcutil.Amount)
sentMsgs: make(chan lnwire.Message, 2000),
quit: make(chan struct{}),
}
globalPolicy = ForwardingPolicy{
globalPolicy = models.ForwardingPolicy{
MinHTLCOut: lnwire.NewMSatFromSatoshis(5),
MaxHTLC: lnwire.NewMSatFromSatoshis(chanAmt),
BaseFee: lnwire.NewMSatFromSatoshis(1),
@ -4374,7 +4375,7 @@ func (h *persistentLinkHarness) restartLink(
quit: make(chan struct{}),
}
globalPolicy = ForwardingPolicy{
globalPolicy = models.ForwardingPolicy{
MinHTLCOut: lnwire.NewMSatFromSatoshis(5),
BaseFee: lnwire.NewMSatFromSatoshis(1),
TimeLockDelta: 6,
@ -5630,7 +5631,7 @@ func TestExpectedFee(t *testing.T) {
}
for _, test := range testCases {
f := ForwardingPolicy{
f := models.ForwardingPolicy{
BaseFee: test.baseFee,
FeeRate: test.feeRate,
}
@ -5716,7 +5717,7 @@ func TestCheckHtlcForward(t *testing.T) {
link := channelLink{
cfg: ChannelLinkConfig{
FwrdingPolicy: ForwardingPolicy{
FwrdingPolicy: models.ForwardingPolicy{
TimeLockDelta: 20,
MinHTLCOut: 500,
MaxHTLC: 1000,

View File

@ -840,7 +840,7 @@ func (f *mockChannelLink) getDustClosure() dustClosure {
func (f *mockChannelLink) HandleChannelUpdate(lnwire.Message) {
}
func (f *mockChannelLink) UpdateForwardingPolicy(_ ForwardingPolicy) {
func (f *mockChannelLink) UpdateForwardingPolicy(_ models.ForwardingPolicy) {
}
func (f *mockChannelLink) CheckHtlcForward([32]byte, lnwire.MilliSatoshi,
lnwire.MilliSatoshi, uint32, uint32, uint32,

View File

@ -611,7 +611,7 @@ func (s *Switch) SendHTLC(firstHop lnwire.ShortChannelID, attemptID uint64,
// forwarding policies for all links have been updated, or the switch shuts
// down.
func (s *Switch) UpdateForwardingPolicies(
chanPolicies map[wire.OutPoint]ForwardingPolicy) {
chanPolicies map[wire.OutPoint]models.ForwardingPolicy) {
log.Tracef("Updating link policies: %v", newLogClosure(func() string {
return spew.Sdump(chanPolicies)

View File

@ -23,6 +23,7 @@ import (
"github.com/go-errors/errors"
sphinx "github.com/lightningnetwork/lightning-onion"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/channeldb/models"
"github.com/lightningnetwork/lnd/contractcourt"
"github.com/lightningnetwork/lnd/htlcswitch/hop"
"github.com/lightningnetwork/lnd/input"
@ -1069,7 +1070,7 @@ func createTwoClusterChannels(t *testing.T, aliceToBob,
// hopNetwork is the base struct for two and three hop networks
type hopNetwork struct {
feeEstimator *mockFeeEstimator
globalPolicy ForwardingPolicy
globalPolicy models.ForwardingPolicy
obfuscator hop.ErrorEncrypter
defaultDelta uint32
@ -1078,7 +1079,7 @@ type hopNetwork struct {
func newHopNetwork() *hopNetwork {
defaultDelta := uint32(6)
globalPolicy := ForwardingPolicy{
globalPolicy := models.ForwardingPolicy{
MinHTLCOut: lnwire.NewMSatFromSatoshis(5),
BaseFee: lnwire.NewMSatFromSatoshis(1),
TimeLockDelta: defaultDelta,

View File

@ -21,6 +21,7 @@ import (
"github.com/lightningnetwork/lnd/build"
"github.com/lightningnetwork/lnd/chainntnfs"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/channeldb/models"
"github.com/lightningnetwork/lnd/channelnotifier"
"github.com/lightningnetwork/lnd/contractcourt"
"github.com/lightningnetwork/lnd/discovery"
@ -234,7 +235,7 @@ type Config struct {
// RoutingPolicy is used to set the forwarding policy for links created by
// the Brontide.
RoutingPolicy htlcswitch.ForwardingPolicy
RoutingPolicy models.ForwardingPolicy
// Sphinx is used when setting up ChannelLinks so they can decode sphinx
// onion blobs.
@ -877,9 +878,9 @@ func (p *Brontide) loadActiveChannels(chans []*channeldb.OpenChannel) (
// If we don't yet have an advertised routing policy, then
// we'll use the current default, otherwise we'll translate the
// routing policy into a forwarding policy.
var forwardingPolicy *htlcswitch.ForwardingPolicy
var forwardingPolicy *models.ForwardingPolicy
if selfPolicy != nil {
forwardingPolicy = &htlcswitch.ForwardingPolicy{
forwardingPolicy = &models.ForwardingPolicy{
MinHTLCOut: selfPolicy.MinHTLC,
MaxHTLC: selfPolicy.MaxHTLC,
BaseFee: selfPolicy.FeeBaseMSat,
@ -934,7 +935,7 @@ func (p *Brontide) loadActiveChannels(chans []*channeldb.OpenChannel) (
// addLink creates and adds a new ChannelLink from the specified channel.
func (p *Brontide) addLink(chanPoint *wire.OutPoint,
lnChan *lnwallet.LightningChannel,
forwardingPolicy *htlcswitch.ForwardingPolicy,
forwardingPolicy *models.ForwardingPolicy,
chainEvents *contractcourt.ChainEventSubscription,
syncStates bool) error {
@ -3839,7 +3840,7 @@ func (p *Brontide) addActiveChannel(c *channeldb.OpenChannel) error {
// the total value of outstanding HTLCs.
fwdMinHtlc := lnChan.FwdMinHtlc()
defaultPolicy := p.cfg.RoutingPolicy
forwardingPolicy := &htlcswitch.ForwardingPolicy{
forwardingPolicy := &models.ForwardingPolicy{
MinHTLCOut: fwdMinHtlc,
MaxHTLC: c.LocalChanCfg.MaxPendingAmount,
BaseFee: defaultPolicy.BaseFee,

View File

@ -7,8 +7,8 @@ import (
"github.com/btcsuite/btcd/wire"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/channeldb/models"
"github.com/lightningnetwork/lnd/discovery"
"github.com/lightningnetwork/lnd/htlcswitch"
"github.com/lightningnetwork/lnd/kvdb"
"github.com/lightningnetwork/lnd/lnrpc"
"github.com/lightningnetwork/lnd/lnwire"
@ -21,7 +21,7 @@ type Manager struct {
// UpdateForwardingPolicies is used by the manager to update active
// links with a new policy.
UpdateForwardingPolicies func(
chanPolicies map[wire.OutPoint]htlcswitch.ForwardingPolicy)
chanPolicies map[wire.OutPoint]models.ForwardingPolicy)
// PropagateChanPolicyUpdate is called to persist a new policy to disk
// and broadcast it to the network.
@ -66,7 +66,7 @@ func (r *Manager) UpdatePolicy(newSchema routing.ChannelPolicy,
var failedUpdates []*lnrpc.FailedUpdate
var edgesToUpdate []discovery.EdgeWithInfo
policiesToUpdate := make(map[wire.OutPoint]htlcswitch.ForwardingPolicy)
policiesToUpdate := make(map[wire.OutPoint]models.ForwardingPolicy)
// Next, we'll loop over all the outgoing channels the router knows of.
// If we have a filter then we'll only collected those channels,
@ -106,7 +106,7 @@ func (r *Manager) UpdatePolicy(newSchema routing.ChannelPolicy,
})
// Add updated policy to list of policies to send to switch.
policiesToUpdate[info.ChannelPoint] = htlcswitch.ForwardingPolicy{
policiesToUpdate[info.ChannelPoint] = models.ForwardingPolicy{
BaseFee: edge.FeeBaseMSat,
FeeRate: edge.FeeProportionalMillionths,
TimeLockDelta: uint32(edge.TimeLockDelta),

View File

@ -7,8 +7,8 @@ import (
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/wire"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/channeldb/models"
"github.com/lightningnetwork/lnd/discovery"
"github.com/lightningnetwork/lnd/htlcswitch"
"github.com/lightningnetwork/lnd/kvdb"
"github.com/lightningnetwork/lnd/lnrpc"
"github.com/lightningnetwork/lnd/lnwire"
@ -50,7 +50,7 @@ func TestManager(t *testing.T) {
}
updateForwardingPolicies := func(
chanPolicies map[wire.OutPoint]htlcswitch.ForwardingPolicy) {
chanPolicies map[wire.OutPoint]models.ForwardingPolicy) {
if len(chanPolicies) == 0 {
return