multi: thread bandwidth check amount down to MayAddOutgoingHtlc
Pass htlc amount down to the channel so that we don't need to rely on minHtlc (and pad it when the channel sets a 0 min htlc). Update test to just check some sane values since we're no longer relying on minHtlc amount at all.
This commit is contained in:
13 files changed
+81
-39
No files matched your search
@@ -102,8 +102,9 @@ type ChannelUpdateHandler interface {
|
||||
EligibleToForward() bool
|
||||
|
||||
// MayAddOutgoingHtlc returns an error if we may not add an outgoing
|
||||
// htlc to the channel.
|
||||
MayAddOutgoingHtlc() error
|
||||
// htlc to the channel, taking the amount of the htlc to add as a
|
||||
// parameter.
|
||||
MayAddOutgoingHtlc(lnwire.MilliSatoshi) error
|
||||
|
||||
// ShutdownIfChannelClean shuts the link down if the channel state is
|
||||
// clean. This can be used with dynamic commitment negotiation or coop
|
||||
|
||||
+6
-4
@@ -2203,10 +2203,12 @@ func (l *channelLink) Bandwidth() lnwire.MilliSatoshi {
|
||||
return l.channel.AvailableBalance()
|
||||
}
|
||||
|
||||
// MayAddOutgoingHtlc indicates whether we may add any more outgoing htlcs to
|
||||
// this channel.
|
||||
func (l *channelLink) MayAddOutgoingHtlc() error {
|
||||
return l.channel.MayAddOutgoingHtlc()
|
||||
// MayAddOutgoingHtlc indicates whether we can add an outgoing htlc with the
|
||||
// amount provided to the link. This check does not reserve a space, since
|
||||
// forwards or other payments may use the available slot, so it should be
|
||||
// considered best-effort.
|
||||
func (l *channelLink) MayAddOutgoingHtlc(amt lnwire.MilliSatoshi) error {
|
||||
return l.channel.MayAddOutgoingHtlc(amt)
|
||||
}
|
||||
|
||||
// getDustSum is a wrapper method that calls the underlying channel's dust sum
|
||||
|
||||
+1
-1
@@ -784,7 +784,7 @@ func (f *mockChannelLink) Peer() lnpeer.Peer { return
|
||||
func (f *mockChannelLink) ChannelPoint() *wire.OutPoint { return &wire.OutPoint{} }
|
||||
func (f *mockChannelLink) Stop() {}
|
||||
func (f *mockChannelLink) EligibleToForward() bool { return f.eligible }
|
||||
func (f *mockChannelLink) MayAddOutgoingHtlc() error { return nil }
|
||||
func (f *mockChannelLink) MayAddOutgoingHtlc(lnwire.MilliSatoshi) error { return nil }
|
||||
func (f *mockChannelLink) ShutdownIfChannelClean() error { return nil }
|
||||
func (f *mockChannelLink) setLiveShortChanID(sid lnwire.ShortChannelID) { f.shortChanID = sid }
|
||||
func (f *mockChannelLink) UpdateShortChanID() (lnwire.ShortChannelID, error) {
|
||||
|
||||
Reference in new issue
Block a user